|
Answer» I need to create a BATCH file that copies the files within a directory to another location only if the files are newer than what's currently there. I'm a REAL novice creating batch files and am not sure how to do this. Can I use the Copy command to copy a directory? Can I use the "if newer" command to specify which files to copy? If so, how do I state the command?
I also need to set up a weekly backup command in the Windows SCHEDULED tasks. I believe I can point to a batch file and schedule it to run at a certain time. I've tested this a bit and KEEP getting an error about permissions. I leave my logged on user with full rights and set a password but keep getting the error. Does the batch file need to be located in a certain location?
All of this is being done on Windows XP SP2, Dos 6.5.
Any help you can offer regarding this matter will be appreciated.You can use XCOPY with the /D to copy only files that are newer or do not exist in the destination. For example, if the files you want to back up are in C:\Documents and Settings\Debbie\My Documents and you want to back them up to C:\Backup, you could use Code: [Select]xcopy "C:\Documents and Settings\Debbie\My Documents\*.*" C:\Backup\ /D /YIf you also wanted to get all subdirectories, then use Code: [Select]xcopy "C:\Documents and Settings\Debbie\My Documents\*.*" C:\Backup\ /D /Y /SNotes: The /Y tells XCOPY to overwrite the old files without prompting The /S tells XCOPY to get subdirectories If the directory names have spaces in them, be sure to use "QUOTES"
|