Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Creating simple copy batch file


  • Please log in to reply
7 replies to this topic

#1 huntsin2

huntsin2

  • Members
  • 253 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:54 PM

Posted 18 April 2017 - 10:09 PM

Hi,

 

I am trying to create a simple batch file that will run once a backup is finished in Acronis that copies a backup(s) from one external hard drive "E:" to "F:" and also from "E:" to "C:" (which is the local SSD).

 

Below are the commands that I wrote out.

 

ECHO
Xcopy /I E:\Acronis Backups Mark F:\Acronis Backups Mark Copy
Xcopy /I E:\Acronis Backups Mark C:\Acronis Backups Mark Copy
 
I feel that this is a very simple task, and I'm not sure what I'm missing or doing wrong.
 
Help would be greatly appreciated.


BC AdBot (Login to Remove)

 


#2 TsVk!

TsVk!

    penguin farmer


  • Members
  • 6,234 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:The Antipodes
  • Local time:03:54 AM

Posted 18 April 2017 - 10:58 PM

Looks like there are spaces in your path, you're also copying a folder and may want to include any subfolders with /s

 

try

Xcopy "E:\Acronis Backups Mark" "F:\Acronis Backups Mark Copy" /i /s
 
I always use ss64.com for all my command reference.


#3 TsVk!

TsVk!

    penguin farmer


  • Members
  • 6,234 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:The Antipodes
  • Local time:03:54 AM

Posted 18 April 2017 - 11:03 PM

Probably better off using robocopy anyways, as xcopy has been deprecated.



#4 huntsin2

huntsin2
  • Topic Starter

  • Members
  • 253 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:54 PM

Posted 19 April 2017 - 05:04 PM

Looks like there are spaces in your path, you're also copying a folder and may want to include any subfolders with /s
 
try

Xcopy "E:\Acronis Backups Mark" "F:\Acronis Backups Mark Copy" /i /s
 
I always use ss64.com for all my command reference.

 

 
I added the quotes and opened an elevated command prompt and it worked. Thanks. Is there anything that I would need to put in the batch file for it to run with administrator privileges?



#5 TsVk!

TsVk!

    penguin farmer


  • Members
  • 6,234 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:The Antipodes
  • Local time:03:54 AM

Posted 19 April 2017 - 05:31 PM

To always run it as admin put it where you want to keep it (somewhere not on your desktop), then right click > create shortcut.

 

Move that shortcut where you want it, then right click > properties > shortcut tab > advanced > check run as admin.  Ok & ok out.



#6 TsVk!

TsVk!

    penguin farmer


  • Members
  • 6,234 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:The Antipodes
  • Local time:03:54 AM

Posted 19 April 2017 - 06:36 PM

Did you read the robocopy explanation?

 

By default Robocopy will only copy a file if the source and destination have different time stamps or different file sizes.

 

This may suit your purpose better.

 

If you have any problem creating a script I'm happy to help. :thumbup2:



#7 huntsin2

huntsin2
  • Topic Starter

  • Members
  • 253 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:54 PM

Posted 20 April 2017 - 11:22 AM

Thanks for your replies, I really do appreciate it.

 

I wasn't sure what syntax would be best for my purposes. I don't or won't have any subfolders.

 

Would it just be

 

robocopy "E:\Acronis Backups Mark" "F:\Acronis Backups Mark Copy"

robocopy "E:\Acronis Backups Mark" "C:\Acronis Backups Mark Copy"
 
Also, I was only going to store the full backup on my hard drive until I burn them to BluRay and then delete them. Is it important that I delete the folder as well, so that it doesn't exist when it goes to create the new folder during the batch file?
 
-------------
 
If I wanted to just copy the differentials instead of the full backups to the existing location using the xcopy command I believe it would be something like below.
 
ECHO
Xcopy /I /D:4/20/2017 "E:\Acronis Backups Mark" "F:\Acronis Backups Mark"
Xcopy /I /D:4/20/2017 "E:\Acronis Backups Mark" "C:\Acronis Backups Mark"
 
What would it be like with robocopy?


#8 TsVk!

TsVk!

    penguin farmer


  • Members
  • 6,234 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:The Antipodes
  • Local time:03:54 AM

Posted 20 April 2017 - 04:45 PM

Robocopy just copies the differentials as default, that's what I was getting at in post #6. So your little script above would work just perfectly, as well as copying all the permissions by default also. :)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users