1.

Solve : Need to create a back-up batch file?

Answer»

Forgive me if this is in the wrong place. I didn't see a forum for something like this.

What I need to do is make a batch file (I think) that will run every time my computer shuts down. What I need this file to do is make a backup of the files I changed during the course of the day, and copy them to the server.

On my computer, I want everything thats in the folder called c:\drawings\>jobname<\design to be copied to h:\TC JOB Folders\>jobname<\Design

Now there are hundreds of different >jobname< folders and each has a 'design' folder, so I need >jobname< to match >jobname<

If possible, I would like it to only overwrite files that have been changed and leave those with the same date alone.

Can this be done?

Obviously the problem I am having is that people who don't always have access to my computer sometimes need access to my work and I don't want an old version of a drawing SENT out by mistake. I try to remember to do backups daily, but sometimes it doesnt get done, or I change 20 files during the course of the day and don't back them all up to the server.why dont just keep re-writing them over. much easier to make.
Code: [Select]@echo off
copy "c:\drawings\>jobname here<\design" "H:\TC Job Folders\>job name here<\Designhope this helpsAre there other DIRECTORIES in C:\drawings that you do not want to copy? Assuming that you want everything under C:\drawings, I think this will do exactly what you want:

Code: [Select]xcopy C:\drawings\ "H:\TC Job Folders\" /s /c /d /y
This will only copy updated files or NEW files from C:\drawings to H:\TC Job Folders. If the same file exists it will just ignore it.

If you only want what is in C:\drawings\[jobnumber]\design without the other stuff, then it can still be done, but with a little bit of extra code in a for /f loop like:

Code: [Select]@echo off
for /f "delims=" %%a in ('dir C:\drawings /ad /b') do xcopy "C:\drawings\%%a\design\ "H:\TC Job Folders\%%a\Design\" /s /c /d /y



Discussion

No Comment Found