Link to home
Start Free TrialLog in
Avatar of mudcow007
mudcow007Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Batch file to move files on network using unc

Hello all

im trying to use a batch file to copy files from off a list an insert them into another folder all within the network.

i have this

for /f "delims=" %%i in (filelist.txt) do echo F|xcopy "\\server1\data1\Images\%%i" "\\server2\data2\Images\%%i" /i /z /y

when i run this batch i get an error that reads

CMD.EXE was started with the above path as current directory

UNC paths are not supported. Defaulting to windows directory

any ideas??

thanks
Avatar of jsdray
jsdray
Flag of United States of America image

may want to try  robocopy... it supports UNC names...

http://technet.microsoft.com/en-us/library/cc733145(v=ws.10).aspx
Avatar of oBdA
oBdA

The error itself can be ignored; what's causing problems is that the script expects filelist.txt in the current folder, which isn't valid as UNC path. Try this:
cd /d C:\Windows
cls
for /f "usebackq delims=" %%i in ("%~dp0filelist.txt") do echo F|xcopy "\\server1\data1\Images\%%i" "\\server2\data2\Images\%%i" /i /z /y

Open in new window

is the file list in the same Directory?
ASKER CERTIFIED SOLUTION
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mudcow007

ASKER

i tried you version oBdA

but got the error "The system could not find the file filelist.txt.

the actual file list is in the same folder on the network as the bat file - if that makes sense

thanks!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cheers guys got it to work!

thanks