Forum Moderators: open
I am currently working on three different computers (two at home and one at work) and I use one external hard disk as backup.
I am looking for a tool (freeware preferably) that could compare directories/files so that my external hard disk only contains the latest updated files or new files.
I hope you understand me.
Thanks for sharing.
Tomda
Many people don't realise this, but you can easily use the xcopy command to do this...
Whenever Windows changes a file, i.e. you open a file and save it, or create a new file, it turns the archive attribute on. You can see this if you right click a file, click properties. See the attributes at the bottom, click Advanced and you'll see a "File is ready for archiving" box. This is the archive attribute.
Now, xcopy has a command line switch, /M, that only copies file with the archive attribute, and removes it once it has successfully copied the file.
See where I'm going with this?
i would ratther prefer an application where I can select directory in external disk and compare it with directory on hard drive.
anyway, thanks again... Will get back to you after testing that inetgrated windows archive system.
Tomda
The command:
XCOPY /M /E /Y C:\DATA D:\
Will copy the contents of the C:\DATA folder to the root of your removable drive.
/M tells it to only copy the archive files and reset the bit.
/E tells it to copy all subdirectories and files, even if empty.
/Y TURNS OFF! prompting to overwrite files.
So, first time you run it, it copies everything, but turns off archive flag.
Now, you change 5 files. Windows turns on archive flag.
You run same command again, now xcopy only looks for files with archive flag, so only the 5 changed files are copied.
Best thing to do is copy a few files into a folder and have a play. It's extremely simple and works very well for what is effectively, an incremental backup.
For more help, type XCOPY /? in a command window.
[edited by: Dabrowski at 4:30 pm (utc) on Oct. 24, 2008]
Use a text editor and create a file called bu.bat... In that file enter the following:
XCOPY %1 %2 /M /E /Y
Now, from a DOS prompt you should be able to type:
bu c:\data d:\data
-OR-
bu *.html d:\htmlfiles
-OR-
bu c:\site1\images\*.jpg d:\jpgfiles
If you want to make it easy and you have a set procedure of backing up the same directories or files all the time, you could hard code them in BATCH FILE(S), e.g.-
(put as many different XCOPY commands as you want into a single "bu.bat" batch file)
XCOPY c:\data\images\*.jpg d:\data\jpgfiles /M /E /Y
XCOPY c:\site1 d:\site1 /M /E /Y
XCOPY c:\older\*.txt d:\older\text\ /M /E /Y
From a DOS prompt, type: xcopy /? and you'll get the full syntax and all the switches, (in-fact you can type /? after any DOS command and get the syntax, options and switches for that command).
ok, here's the next thing that will thwarte you, what if your removable drive is a different letter on different computers?
Put this code in your bu.bat (before the xcopy), it will search for itself, set a variable and then use that in your xcopy command.....
IF EXIST D:\BU.BAT SET MYHDD=D
IF EXIST E:\BU.BAT SET MYHDD=E
IF EXIST F:\BU.BAT SET MYHDD=F
IF EXIST G:\BU.BAT SET MYHDD=G
IF EXIST H:\BU.BAT SET MYHDD=H
...
you get the idea, go as far as you need to
...
I believe there's a more efficient way using FOR/IN but I never could get that to work properly.
So, we look for a file we know must exist, and set a variable (MYHDD) with the drive letter it's found on.
Now, change your xcopy command as follows:
XCOPY c:\data\images\*.jpg %MYHDD%:\data\jpgfiles /M /E /Y
XCOPY c:\site1 %MYHDD%:\site1 /M /E /Y
XCOPY c:\older\*.txt %MYHDD%:\older\text\ /M /E /Y
By using %MYHDD% we are telling the script, and yes it is now a simple script, to use that variable.
Even has scheduling option. It's not free though.