1.

Solve : Newbie - creating a bat file to backup files by creation date?

Answer»

Hi folks. Hope you can help me!

I'm totally new to creating .bat files, but it LOOKS like they COULD be pretty useful for me. Have been trying to figure this out for a couple of days now and am afraid I've given up - can't seem to find the basic info I need on the net, it's all a bit technical and I'm having trouble making sense of it.

I am sure this is possible to do (and very easy to do - for you experts out there!).

Anyway - I have a folder containing files created on different dates (phone call recordings). New files are added to this folder every day. At the end of every day I need to take a backup of this folder.

I need the files to be copied into folders that specify the creation date of the file. For example - all the CALLS made on 31st August would go in a folder called 2007-Aug-31, and those on the 30th August would go in a folder called 2007-Aug-30 and so on.

I want the bat file to COPY over any new files added that day rather than back up the whole thing each evening.

Here is my script so far:

@echo off
:: variables
set drive=e:\Backup
set backupcmd=xcopy /s /c /d /e /h /i /r /k /y

echo ### Backing up calls folder Please wait....
%backupcmd% "H:\Phone Calls" "%drive%\%folder%"

echo Backup Finished!
@pause


Any ideas? I seem to be stuck on the folder creation bit!

Thanks very much.
Ok:
1. Are there errors, or do you just want some help?
2. What are %folder% and %drive%? I can't see any variables declared as that.
3. To make directories, try mkdir.



Discussion

No Comment Found