Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xcopy batch file 2

Status
Not open for further replies.

cimoli

Technical User
Jul 30, 2010
207
0
0
US
I use windows 8. I want to use a batch file using xcopy. it almost works.
I get an 'access denied' error. Can you improve my batch file to work?
I am backing up to the WDigital MyPassport drive that I inserted to my E: drive usb. thanks

Echo on
verify on
rem Attach the WD MyPassport to E: drive.
pause

xcopy C:\Users\Glen\Documents\*.* E:\Backup\*.* /c /d /e /h /i /k /q /r /s /x /y

rem DONE
pause
echo on
 
Are you running as "Glen"?
Do you have access to C:\users\glen\documents?
Does E:\backup already exist? - was this created by a different user with different privileges?
 
I'd use robocopy instead which would skip existing/unchanged files. But, wondering why you want some of these options:
/H /K /X - seems unnecessary if you just want your data.

batch file content below - nothing else needed. Right Click - Run AS administrator or Scheduled task with highest privilege.
robocopy.exe C:\users\glen\documents E:\backup /MIR /XA:SH /FFT /TEE /ZB /R:2 /W:5 /LOG:"C:\backup.log"

/MIR will delete files that are NOT in the source. You can remove that for a regular copy
If you add /L it will only do a trial run - no data copied/changed but log file will reflect what it WOULD have done. Remove /L once it seems to be doing what you want.

Robocopy switches expl Linkained

"Living tomorrow is everyone's sorrow.
Modern man's daydreams have turned into nightmares.
 
I have 3 computers that i want to backup to my windows XP server to my server's E: drive where I have a western digital MyPassport external drive.

I made an Xcopy batch file. See below.

The file works fine the first time. But later, after making a file change or new files, the batch file
does not pick up on them. The 2nd time around, basically, nothing happens.
I wanted files that were the same to be skipped and just the new files or revised files to be copied to the E: drive.
Directories too. any ideas?


===========================


Echo ON
Verify ON
Echo .Insert MyPassport to E: drive
pause

Echo .Parker is Sam
xcopy P:\ E:\ParkerBackup\ /d /e /v /y

Echo .Utley is Bridget
xcopy U:\ E:\UtleyBackup\ /d /e /v /y
pause

Echo .Yaz is Kelly
xcopy Y:\ E:\YazBackup\ /d /e /v /y

Rem ALL DONE
pause

===================================
 
I should explain. EG P:\ drive workstation is mapped as \\Parker\my documents.

And so on. Maybe instead of P:\, I need something more precise in my xcopy command
when i am on the server ?
 
I have a windows 8 PC where I use the MyPassport drive E: to copy the data files.
It works well. I am on the Mantle windows 8 station when i do this batch file.
It is different than the above since i am not on the server when i do this.
It is the standalone computer.

I use:

xcopy C:\users\owner\documents E:\MantleBackup\ /d /e /v /y

So I must be close on the other angle when i use a windows xp lan drive letter.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top