Move Folders containing Subdirectories to UNC location

To add,

the src and destination are both remote UNC paths from the machine running the task (i.e. not local) The W7 test is using local folders.

Adding the /s switch to your command will fix the problem, both for local and UNC folders:

robocopy "src "dest" /E /MOVE /MINAGE:11  /s

November 21st, 2013 3:49pm

I think the issue is with Robocopy moving all suddirectories but only moving files older than MINAGE. So empty folders are created as their file was filtered out.

I effectively need move folder older than, I think Robo is moving all folders but also only files older than...

This thread is proving to be quite elusive. Here is why:

  • In your first post you said that you ended up with flat folders (without showing us your robocopy command). This turned out to be incorrect - the /s switch ensures that subdirectories are copied too.
  • You then suggested that UNC paths have something to do with your problem. Not so - robocopy will move files for local and UNC paths.
  • You now think that empty subdirectories are created when they contain no files that meet the /MinAge switch. My tests suggest that this is also incorrect.

I recommend that you do some careful testing of your own, then post again when you find a problem that you can nail down with a solid test. Note also that this is a scripting forum. It focuses on helping posters with script problems (Powershell, VBScript, batch). Using robocopy is not really scripting - it goes under the heading of "console commands".

Free Windows Admin Tool Kit Click here and download it now
November 21st, 2013 6:43pm

Hi,

is there a script or method that can be used to move subfolders to an archive location - Windows Server 2008 to Linux NAS box

The subfolders are to be filtered by date modified

the folders contain a zip file and html file

I have tried Robocopy MOVE but this seems to spit out the folders without retaining the structure (i.e. I end up with a flat structure of all folders)

Is there a method in Powershell which require COPY-ITEM then REMOVE-ITEM

Are there tools that can be installed instead - rsync appears to replicate rathern than move.

In short, I'd like a command line/script version of right click > cut.

Thanks in advance for any suggestions

November 22nd, 2013 7:12am

I have tried Robocopy MOVE but this seems to spit out the folders without retaining the structure (i.e. I end up with a flat structure of all folders)

Hard to say unless you post the robocopy command line you used. I suspect you forgot to add the /s (subdirectories) switch.
Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2013 7:18am

robocopy "src "dest" /E /MOVE /MINAGE:11

Yet everything is copied, regardless of age and without directory structure.

If I run the command on W7 desktop, all ok.

Folders are named and structured as below:

Parentfolder: parent

level1subfolder: thisname.zip (file folder)

level2subfolder: thisname.zip (compressed folder)

level2file: thisname.zip.html

Where thisname is the same.

Thanks

November 22nd, 2013 7:48am

To add,

the src and destination are both remote UNC paths from the machine running the task (i.e. not local) The W7 test is using local folders.

Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2013 7:51am

To add,

the src and destination are both remote UNC paths from the machine running the task (i.e. not local) The W7 test is using local folders.

Adding the /s switch to your command will fix the problem, both for local and UNC folders:

robocopy "src "dest" /E /MOVE /MINAGE:11  /s

November 22nd, 2013 8:09am

Thanks for your help with this

I think the issue is with Robocopy moving all suddirectories but only moving files older than MINAGE. So empty folders are created as their file was filtered out.

I effectively need move folder older than, I think Robo is moving all folders but also only files older than...


Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2013 10:38am

I think the issue is with Robocopy moving all suddirectories but only moving files older than MINAGE. So empty folders are created as their file was filtered out.

I effectively need move folder older than, I think Robo is moving all folders but also only files older than...

This thread is proving to be quite elusive. Here is why:

  • In your first post you said that you ended up with flat folders (without showing us your robocopy command). This turned out to be incorrect - the /s switch ensures that subdirectories are copied too.
  • You then suggested that UNC paths have something to do with your problem. Not so - robocopy will move files for local and UNC paths.
  • You now think that empty subdirectories are created when they contain no files that meet the /MinAge switch. My tests suggest that this is also incorrect.

I recommend that you do some careful testing of your own, then post again when you find a problem that you can nail down with a solid test. Note also that this is a scripting forum. It focuses on helping posters with script problems (Powershell, VBScript, batch). Using robocopy is not really scripting - it goes under the heading of "console commands".

November 22nd, 2013 11:03am

I think the issue is with Robocopy moving all suddirectories but only moving files older than MINAGE. So empty folders are created as their file was filtered out.

I effectively need move folder older than, I think Robo is moving all folders but also only files older than...

This thread is proving to be quite elusive. Here is why:

  • In your first post you said that you ended up with flat folders (without showing us your robocopy command). This turned out to be incorrect - the /s switch ensures that subdirectories are copied too.
  • You then suggested that UNC paths have something to do with your problem. Not so - robocopy will move files for local and UNC paths.
  • You now think that empty subdirectories are created when they contain no files that meet the /MinAge switch. My tests suggest that this is also incorrect.

I recommend that you do some careful testing of your own, then post again when you find a problem that you can nail down with a solid test. Note also that this is a scripting forum. It focuses on helping posters with script problems (Powershell, VBScript, batch). Using robocopy is not really scripting - it goes under the heading of "console commands".

This works now.

The first post was a generalised question - script or method - as to achieving the end result

I provided a fuller explanation of the environment I had tested in. You provided your own suggestion that UNC was the problem

Empty subdirectories were created by a set of my tests - please post the scope of your tests that proved otherwise

I refer you to my above answer - this was a generalised question that included Powershell - you focused on Robocopy.

Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2013 11:44am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics