AboutAlex Barry Expertise I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.
Experience Hobby programming since 2000
I no longer belong to any community programming groups, but do have knowledge of *basic dialects and C/C++
I'm trying to make a batch file to back up new documents to a flash drive so if the hard drive goes out I have my documents.
All I should have to do is click on the icon on my desktop (Windows XP) and the file should back up the needed documents to the flash drive. After the first back up it should only copy new or changed files.
I keep getting an 'invalid path' error. I've tried lots of different paths:
For example - - I:\ for the 'from' path and also different versions of the path for the 'to' version, but nothing seems to work.
Am I doing something which is basically impossible? I don't see why it shouldn't be possible though...
See the attached files for the Explorer view of her computer and the result I get when I try to run the batch file.
The 'I' drive is the flash drive and her files are on the 'C' drive.
Thanks,
Jim
HERE IS MY BATCH FILE:
*******************************************
@echo off
:: variables
set drive=I:\Phyllis
set backupcmd=xcopy /s /c /d /e /h /i /r /y
echo ### Backing up My Documents...
%backupcmd% "C:\Documents and Settings\Phyllis\My Documents\"
echo Backup Complete!
@pause
*******************************************
Note, I have a similar batch file on my home computer which works fine. Here is the one on my home computer:
@echo off
:: variables
set drive=D:\Tempbackups
set backupcmd=xcopy /s /c /d /e /h /i /r /y
echo ### Backing up My Documents...
%backupcmd% "L:\My Documents\Autocad--DRW" "%drive%\Autocad--DRW"
%backupcmd% "L:\My Documents\Jim" "%drive%\Jim"
%backupcmd% "L:\My Documents\Kalu" "%drive%\Kalu"
echo Backup Complete!
@pause
Answer Hi, Jim,
First, I want to note that this is the QBasic section, and not a DOS-Batch section, so technically, there is no guarantee that I'd know anything about this. Luckily, I do know batch, but next time, make sure this gets to the right section.
The problem is you're not telling xcopy where to put your files...
%backupcmd% "C:\Documents and Settings\Phyllis\My Documents\"
This doesn't say where you're copying files to, just where the original files are, to fix that:
%backupcmd% "C:\Documents and Settings\Phyllis\My Documents\" "%drive%\Phyllis"