How do I copy all of the files from a mapped network drive's shared folder to the local c: drive?

Posted on 2006-10-26
Medium Priority
Last Modified: 2010-04-18
I need a script to copy files from a network share (drive is already mapped) to the local c: drive of many pc's.  
I am thinking of something like this.  Beware, as I am a newbie at this:

@echo off
if exist x:\ net use x: /delete
net use x: \\server1\share
copy x:\*.* \\%computername%\c:
start file.exe
::  file.exe is one of the files that was copied over from the \\server1\share

Question by:cliffordgormley
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
  • 3
  • 2
LVL 26

Expert Comment

ID: 17815926

What's the goal of this script, precisely?

Is this a one-shot copy or something that will be happening more-or-less daily?

LVL 14

Assisted Solution

inbarasan earned 600 total points
ID: 17818184
If you are going to use this script regularly then you may use xcopy with overwrite option so that it doesn't promopt whether you want to overwrite it or not(This is dangerous also)

Even otherwise xcopy is good.
To know more about xcopy refer : http://www.ss64.com/nt/xcopy.html

Author Comment

ID: 17846644
it is actually going to be a one time copy.  If the script has been run before, I will not need to copy the files over from the server share to the local machine.
I am going to use an IF-THEN statement to check if the script was run before. Those details are not really required, are they?
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

LVL 26

Accepted Solution

MidnightOne earned 1400 total points
ID: 17847256
Script should read, then

@echo off
if exist c:\file.exe GOTO END
xcopy %logonserver%\netlogon\FOLDER c:\*.*
start c:\file.exe

 All files are in FOLDER within the NETLOGON share
 aCopiedFile is one of the files in the group you're copying
 You're using a GPO and setting this as a logon script



Author Comment

ID: 17850177
Hello Midnight.
Looks good, but do the files have to be in the NETLOGON share?  I have already mapped a drive to a folder on the remote server where the files are, and have given the user both Share and NTFS permissions to READ (copy) from that share.  I can post the current script here if you like.

BTW, is XCOPY used instead of COPY because it will automatically overwrite any existing files??
LVL 26

Expert Comment

ID: 17886723

Doesn't have to be in the netlogon share. Personally, I find it easier because all my scripts then look the same.



Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

771 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