Solved

Running scheduled task for data copy

Posted on 2006-06-16
6
3,685 Views
Last Modified: 2012-06-21
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
Comment
Question by:JohnLucania
  • 2
  • 2
6 Comments
 
LVL 32

Expert Comment

by:r-k
ID: 16925757
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
 
LVL 32

Accepted Solution

by:
r-k earned 250 total points
ID: 16925760
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
 
LVL 70

Assisted Solution

by:Merete
Merete earned 250 total points
ID: 16925771
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
 
LVL 70

Expert Comment

by:Merete
ID: 17104281
oh well another no feedback, thanks Lee and DarthMod.
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now