Solved

create a script read a txt file and move folders.

Posted on 2013-01-18
4
399 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 51

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 51

Expert Comment

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

~bp
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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.

759 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

22 Experts available now in Live!

Get 1:1 Help Now