Solved

create a script read a txt file and move folders.

Posted on 2013-01-18
4
403 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 54

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 54

Expert Comment

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

~bp
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DOS command won't run from WScript.Shell 8 63
Batch: check service status 11 93
DOS - Automated Tree Structure Creation 10 97
How to run a .bat file from a no name folder 5 61
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…
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…
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 antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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