Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3692
  • Last Modified:

Running scheduled task for data copy

I have an additional hard drive (E:) and like to run a scheduled job to copy all of the files on 'My Documents' on C: onto E:

The files need to be overwritten.   Basically, I want to back up all of the folders and files daily, but if the job checks the folders not changed (= no new files or no updated files) and skips them, it can save a huge time since there are a quite large number of folders and files ( ~ 7 GB).

How do you do this?


0
JohnLucania
Asked:
JohnLucania
  • 2
  • 2
2 Solutions
 
r-kCommented:
Just create a .bat file (e.g. daily.bat) with the following lines in it (use Notepad)

Rem       /s  means all subdirectories also
Rem       /e  means empty folders also
Rem       /c  means ignore errors
Rem       /f  means full display in console window
Rem       /h  means hidden files also copied
Rem       /d  means copy only those files that have changed
Rem       /y  means do not prompt for overwriting existing files
Rem       /o  means retain file ownership and acl info
xcopy C:\Documents and Settings\<username>\*.* /s/e e:\Backup\ /c/f/h/d/y/o /exclude:exclude.txt

where <username> is your login username. Note that the above example will copy more than just "My Documents" but you can easily modify that, though I do recommend that you copy everything as is in the example.

Also create a file named "exclude.txt" in the same place as daily.bat and insert the following one line in it:

Temporary Internet Files

This will exclude the Internet cache files from being backed up.

Then just use the "Scheduled Tasks" control panel to schedule the daily.bat file to run once a day.

As with  all backups, double-check to make sure things are working as expected.

0
 
r-kCommented:
Since "documents and settings" contains spaces, you may want to modify the command I suggested slightly as follows:

xcopy "C:\Documents and Settings\<username>\*.*" /s/e e:\Backup\ /c/f/h/d/y/o /exclude:exclude.txt

(note the double-quotes)
0
 
MereteCommented:
Hi John this is a bit risky as the time it would probaly take to do this and unattended please make sure you have backed up copies incase something happens you would lose the lot.
Why not do them in increments.
Make sure the hdd is thorougly defragged.
Here is a sample off the Ato Z

Schedule a batch file to run on a computer at a specific date and time. This command is available for backwards compatibility with NT 4 but has been superseded by SCHTASKS.
http://www.ss64.com/nt/at.html
An A-Z Index of the Windows NT/XP command line
http://www.ss64.com/nt/

Backing Up User Data
The script file will contain one or more XCOPY command line(s). Each command line will copy the specified file (or directory) to your specified destination.
Use your favorite text editor to create a script file or .BAT file (we recommend you use NOTEPAD). In our example below, we will use the filename: saveme.bat. Save this file in a familiar location for use in Step 2.
The general form of the XCOPY command is:
XCOPY source destination /switchwhere:
source would be your source directory or file
destination would be your destination directory or file
The common source directories you want to consider coping are:
c:\winnt\profiles\username\My Documents (W-NT)
c:\Documents and Settings\username\My Documents (W-2K/XP)
c:\My Documents\ (W-95/98/ME)
c:\Program Files\Eudora\ (All OS's)
c:\Program Files\Netscape\user\default\bookmark.htm (All OS's)
The example below provides you with our “first best guess” on what might be correct for you. You will need to review the switches allowed and tailor (or customize) each command line to your specific needs.

XCOPY source destination /y /d /e /c /i /f /h /k /o /v /s
/y allows the command to overwrite existing files without input from the user. The /Y switch helps in an automation process.

/d:m-d-y copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/e copies directories and subdirectories, including empty ones.
/c continues copying even if errors occur.
/i if destination does not exist and copying more than one file, assumes that destination must be a directory.
/f displays full source and destination file names while copying.
/h copies hidden and system files also.
/k copies attributes. Normal XCOPY will reset read-only attributes.
/o copies file ownership and ACL information. This will not work correctly under Windows 95/98/ME
/v verifies each new file. The /V is a good choice.
/s copies directories and subdirectories except empty ones.
Procedure for Windows 2000 or Windows XP
Click Start > Run


Type in c:\winnt\tasks for Windows 2000 or c:\windows\tasks for Windows XP


Double-Click Add Scheduled Task


Select Next when the window pops up


Select the Browse button, and explore to where you have saved your backup file. Select the file and open it


Enter the name you would like for the task and select the radio dial next to the frequency that you would like the task performed and select Next


Enter all the information about the time that you would like task to run and select Next


Enter the username and password of the user that you would like the task to run as


Select Finish. Your backup should be set.

http://www.cae.wisc.edu/site/public/?title=protectuserdata

good Luck
Merete
0
 
MereteCommented:
oh well another no feedback, thanks Lee and DarthMod.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now