Solved

Running scheduled task for data copy

Posted on 2006-06-16
6
3,688 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Functional Level 2012 R2 and XP 3 167
Cannot Upgrade Microsoft Installer on Windows 2000 29 67
extend monitor issues 6 46
Windows XP and a 3TB drive that Windows cannot see 19 43
Most of the time we are in fix when all of sudden our systems behave weirdly.  Such problems cost time and effort... so it's best to take some preventive actions so that we can avoid such issues or overcome such problems more easily. Preventive M…
Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 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