Avatar of Robert Berke
Robert Berke
Flag for United States of America asked on

robocopy s:\hugefolder to USB:\smallfolder BUTonly files changed yesterday and today.

We are converting from SBS2003 to Windows Server Essentials 2016.

On WedNesday, I RoboCopied \\SBS2003 to \\WSESERVER (160 Gig of data).  I did NOT take SBS2003 out of service.

On Wednesday and Thursday, the users changed about 200 file or folders on SBS2003.
 (200 filenames were listed using this command):

forfiles /P s:\ /S /D +11/04/2017 /c "cmd /c echo @fdate @ftime @path" > c:\aatmp\allchanged

Open in new window


Is there way to get RoboCopy to put those 200 modified file onto a USB while conserving their parentage  structure ?

For instance  
OldStructure
Root\Bob has many subfolders at multiple levels, but no recently modified files anywhere.
root\Chris also has no changes anywhere
root\Joes has this structure
            .\Ohio  has no changes at any level
            .\NY has 20 folders and 100 files at multiple levels, but there was only file modified was:
              root\Joe\NY\Construction\Mainstreet\plan.pdf  (modified yesterday)

The ideal robocopy would create a single file on the USB:
f:\smallFolder\Joe\NY\Construction\Mainstreet\plan.pdf
Windows OS* Robocopy

Avatar of undefined
Last Comment
Robert Berke

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
NVIT

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Robert Berke

ASKER
Nearly perfect, except it will creates and delete about 80,000 unnecessary folders which make it run really slowly.

Any suggestions?

rberke
P.S.  When  I specify from 11/08/2017 to 11/09/2017, files changed on 11/8 are copied and files changed on 11/09 are NOT copied.  So I will always add 1 to the most recent date desired.
NVIT

...except it will creates and delete about 80,000 unnecessary folders ...

Unfortunately, that's how robocopy works. It makes the empty folders. Hence, the need for the following RD line.

You may be able to do it with FORFILES without the following RD line. IDK if that's faster than the robocopy method.
Robert Berke

ASKER
Actually, robocopy had other problems.  For some reason it stalls at pst files.   They stay on the screen from for many minutes while a processed percentage works its way up to 100%.   Maybe it is reviewing each email?  Anyway, it looks like it is a dead end.

back kto the drawing board.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Robert Berke

ASKER
do you think you could come with a forfiles command?  I am not good at that stuff.  If  not, I will give you points for your previous answer and close the question.
NVIT

I can take a look. IDK if I can finish today. I'm in the middle of something right now... 8-)
NVIT

As far as the PST issue... I don't think it matters if robocopy or forfiles is used. Both use COPY commands. If those are large pst files, it will surely take awhile to copy.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
NVIT

Also, If the PST file is open, i.e. being used by someone, robocopy or forfiles COPY won't be able to copy the pst file. Because Outlook locks the file. Until the user closes Outlook.
Robert Berke

ASKER
I was wrong, the PST was not a problem. It was just a big file that took 5 minutes to copy.


My full job ran for about 80 minutes . The good news is that this an acceptable period of time, so  I am closing the question and awarding you points.

But, I still believe an ideal solution without the useless folders would run in half the time.

Here are a few statistics in case anybody is interested. All numbers are chancy because I did not keep an accurate log.



To get timing statistic I removed your delete loop and reran the job. It ran much faster and finished in 60 minutes

This created C:\aatmp\arobotest2 with 1037 files in 61,084 folders.



I tnen ran your delete logic on arobtest2.  It ran for about 20 minutes

and changed C:\aatmp\arobotest2 to have 1037 files in 172 folders.

So, 60,818 useless folders were deleted in 20 minutes.


My guess is that creating those useless foders also took an additional 20 minutes.

So, the ideal robocopy should have taken 40 minutes instead of 80 minutes.

So, while your solution is not ideal, it works fine.

Thanks for your help.
Robert Berke

ASKER
thanks again
Your help has saved me hundreds of hours of internet surfing.
fblack61