Welcome to the OzoneAsylum FaqWiki
Frequently Asked Questions
Hardware

Quick and Easy Way to Backup Data Pages that link to <a href="https://ozoneasylum.com/backlink?for=5622" title="Pages that link to Quick and Easy Way to Backup Data" rel="nofollow" >Quick and Easy Way to Backup Data\

If you want a quick and easy way to back up data, here is a free solution to your problems:

Originally Posted by Perfect Thunder

Try xcopy /? -- you'll find that this simple command line tool lets you do quite a bit. If all I wanted to do was back up only changed files, I'd use Windows Scheduler to run a batch file with an appropriate series of xcopy commands.


Silence also added a great method on setting this up

Originally Posted by silence

Ah, PT beat me to it.

Seriously, an automated batch file is usually the best solution and it won't cost you a dime.

Here's how it works. You create a text file and use the following as an example:

quote:
--------------------------------------------------------------------------------

CALL ..time_stamp.bat backup_log.txt ::::: Start Backup Task :::::

xcopy /e /y /d /i "c:*.*" "d:backup"

CALL ..time_stamp.bat backup_log.txt ::::: End Backup Task :::::

--------------------------------------------------------------------------------



Now, change the extension on the text file from .txt to .bat and you will then be able to run it in windows. Now, lets break down the commands.

The CALL function calls an external batch file called time_stamp.bat to put a time stamp in a file called backup_log.txt. This file will then contain a record of each time your backup process started and stopped. time_stamp.bat can be obtained from here.

The backup_log.txt file will then contain something like:

02/27/2003 1:28p ::::: Start Backup Task :::::
02/27/2003 1:36p ::::: End Backup Task :::::
02/27/2003 9:05p ::::: Start Backup Task :::::
02/27/2003 9:11p ::::: End Backup Task :::::

The most important line of all contains the xcopy command. xcopy should be available on Windows 2000 and Windows XP. If you have 98 or ME then you'll have to use copy, which isn't as robust. (Tyberius Prime: I highly doubt that. I know that 95/98/Me have xcopy, and while it doesn't have all the parameters of the 2k or XP one, but it will usually do)

The xcopy switches do the following:
/e Copies directories and subdirectories, even empty ones.
/y Suppresses prompting you to confirm overwriting a file.
/d Copy only those files whose source time is newer than the destination time.
/i If destination does not exist and copying more than one file, assumes that destination must be a directory.

The *.* part is important as well since it tells xcopy to copy everything in that directory.

Therefore, the following command:
xcopy /e /y /d /i "c:*.*" "d:backup"
Will copy everything from the root of the c-drive including files, directories, and subdirectories to a directory in the d-drive called "backup". If this directory does not exist, then xcopy will create the directory and all appropriate subdirectories. Also, if there are copies of these files in the d:backup folder already, xcopy will only copy the file if the date on the source file is newer than the date on the destination file.

Now, to run this, simply set up a task (start->programs->accessories->system tools->scheduled tasks) that runs every night at say, 11:55pm and point that task to your batch file.

If you want more information on your backups, create another batch file with the following line:
backup.bat > file_log.txt
Then, point your task to this file. It will run the backup.bat (assuming that was the original file you created) file and pipe all output to file_log.txt. Now, file_log.txt should have a record of all files copied.

One thing to note is that there is no open file support for xcopy, so if it tries to copy over a file you have open (say you still have a .psd open in photoshop) it won't copy that file over and it will return an error. With the /c switch, however, you can tell xcopy to continue copying the other files and skip the one that returned the error.

Hope that helped.


(Added by: CPrompt on Thu 27-Mar-2003)

For more information on xcopy switches, just look under "xcopy" in Windows Help. For a little more expanded information, check out the following link:

Windows XP Documentation : xcopy

(Edited by: Wes on Thu 27-Mar-2003)


(Edited by: Tyberius Prime on Fri 28-Mar-2003)
(Edited by CPrompt on 12-26-2007 19:48)

« BackwardsOnwards »

Show Forum Drop Down Menu