Solved

create a script read a txt file and move folders.

Posted on 2013-01-18
4
401 Views
Last Modified: 2013-01-18
I have a c:\users.txt file which contains a list of user IDs.  

I need to create a script to read the users.txt file and "MOVE" the subfolders in the M:\USERS directory into another server (\\SERVER1\DUMP\USERS).

Will this script works?

for /f %%a in (c:\users.txt) do move m:\users\%%a \\server1\dump\users

I tried to just run "move m:\users\%%a \\server1\dump\users" in the command prompt but it returns "Access is denied".  

It is a Administrator session so I do not know what it the problem.  I have verified right from windows explorer.
0
Comment
Question by:nav2567
  • 2
  • 2
4 Comments
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 38793810
The basic move command won't support this.  I would suggest ROBOCOPY instead, like this:

for /f %%a in (c:\users.txt) do robocopy m:\users\%%a \\server1\dump\users\%%a /move /e

Open in new window

~bp
0
 

Author Comment

by:nav2567
ID: 38794804
Works.

Thanks, Bill!
0
 

Author Closing Comment

by:nav2567
ID: 38794807
Thanks.
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 38795617
Welcome, glad that was helpful, thanks for the feedback.

~bp
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

823 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