Advertisements
TRENDING

A simple ROBOCOPY task, I think not!

We finally received our PowerEdge 1950 Hard Drive Trays. I placed a 180GB SATA HD on the tray and screwed that bad boy up and placed it in the second bay. Remote into the server, open up Computer Management and formatted the HD [NTFS] and assigned it the letter E [easy right?].

Task:

  • copy everything in the D drive to a folder called d_backup in the E drive.
  • do it in a monthly scheduled task

Ideas:

  1. manually copy and paste everything over to E:\d_backup and do it monthly [Ha!]
  2. work smarter and not harder approach and script this task

Solution:

  • What do you think? 😉

So I didn’t know what to use xcopy or robocopy? I used both in the past, but robocopy in my opinion was more robust due to it’s “mirror” mode, which  keeps the folder structure in sync. I went to Microsoft TechNet Library to look at the parameters for the command. These are the ones that caught my eye:

Option Description
/s Copies subdirectories. Note that this option excludes empty directories.
/e Copies subdirectories. Note that this option includes empty directories.
/mir Mirrors a directory tree
/tee Writes the status output to the console window, as well as to the log file
/log+:<logfile> Writes the status output to the log file as Unicode text appends the output to the existing log file

The Script:

echo on

ROBOCOPY D:\ E:\d_backup /s /e /mir /tee /log+:"E:\copylogs.txt"

The Problem:

Even though the script is straight forward in the eyes of a System Administrator, but when the script was done I looked in the E: drive and did not find the d_backup folder. The log file stated that it was successful and the HD dropped down to 165GBs, so I know something was copied.

Research:

I did some research and found this article File and Folder – Hide or Unhide. Now, it’s not that simple. I didn’t bother to check the files in the D drive because there were some system files that will automatically make it hidden if I used xcopy or robocopy. [ Who know?? Seriously?? LOL: got to love technology]

Solution:

You could use the ATTRIB command to unhide the files that are protected by the operating system:

ATTRIB -H -S "Full Path of File with extension"

Once I figured out why the folder was disappearing and fixed it, I opened task scheduler and created my task to run my *.bat file on the first Monday of each month.

If the post was helpful. Please take the time to +1 it.

Advertisements
About BjTechNews (906 Articles)
An IT guy trying to learn everything about technology and sharing it with you all. I'm a blogger and video blogger who highlights daily news in the tech industry, promoting tips and hacks for fellow techies.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s