?
Solved

create a script read a txt file and move folders.

Posted on 2013-01-18
4
Medium Priority
?
410 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 59

Accepted Solution

by:
Bill Prew earned 1500 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 59

Expert Comment

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

~bp
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

850 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