Solved

DOS: Moving file to a location with similar folder structure

Posted on 2013-01-29
7
620 Views
Last Modified: 2013-02-06
I have the following folder struture

C:\Folder 1
  - Subfolder A
  - Subfolder B
  - Subfolder C

Each subfolder has several files within it.  I would like a dos command to move all files across all subfolders to their appropriate subfolder within the following destination location:

C:\Folder 2
  - Subfolder A
  - Subfolder B
  - Subfolder C

For example, a file with the following path "C:\Folder 1\Subfolder B\File.txt" will get moved to "C:\Folder 2\Subfolder B\File.txt" .

Any help is appreciated.
0
Comment
Question by:badabing1
  • 4
  • 3
7 Comments
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 38831193
Sure, XCOPY can do this quite well for you.  Use the /E option to preserve the folder structure, so something like this:

xcopy "C:\Folder 1" "C:\Folder 2" /E /I

Then, if you really want to "move" rather than "copy", after you verify the copy did what you wanted you can delete the source with:

rd /s /q "C:\Folder 1"

If you really have to do it all with one single command, then ROBOCOPY may be the easiest way there, like:

robocopy "C:\Folder 1" "C:\Folder 2" /S /MOVE

~bp
0
 

Author Comment

by:badabing1
ID: 38831288
Thanks for your response bp.
As these files are quite large I would prefer a move as I suspect this would be far quicker than a copy.  This is important as another process is going to pull these files elsewhere and I do not want it half way through a copy when this happens.  

Also I am using RoboFTP's DOSCMD function to do this job.  I do not believe I can run the robocopy command from RoboFTP, is that correct?
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38831328
I haven't used RoboFTP, so I would say give the ROBOCOPY approach a test and see if it works.

~bp
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 51

Expert Comment

by:Bill Prew
ID: 38831343
Taking a quick look at the online help for RoboFTP, you probably need to use the EXEC command to run ROBOCOPY.

~bp
0
 

Assisted Solution

by:badabing1
badabing1 earned 0 total points
ID: 38843058
Thanks for the help bp.

I have used RoboFTP to do the move.  I could not get it to work using the EXEC command:
EXEC "rotoftp.exe c:/folder1 c:/folder2 /MOV /S"

Open in new window

I did however get it to work by adding the above code into a batch file and then calling that batch file through the DOSCMD command within roboftp.
0
 

Author Comment

by:badabing1
ID: 38843089
Closed
0
 

Author Closing Comment

by:badabing1
ID: 38858675
The final solution implemented.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now