1.

Solve : Xcopy vs Copy with UNC paths?

Answer» USERS have shortcut on their desktop that points to a simple bat file (see below)
The batch file creates a new folder on USER's hard drive, if needed, then COPIES an Access front-end file (.MDB) from a network folder down to the hard drive.

I was using xcopy so that it only COPIED the file, IF I had made a change.

I recently had to change to using UNC paths and now that XCopy doesn't seem to work. I can only get it to work for the users with a straight copy. XCopy works fine on my PC. Just before the copy is executed there is a message that "UNC Paths are not supported"

Am I doing something wrong? Is there a delay with the xcopy on the network that I need to "pause" or something?

Any help is appreciated.
TJ
---------
@Echo Off

Rem Check for local copy of XYZ.mdb - if not found, create directory and copy file.
if not exist "C:\TEST1\XYZ.mdb" mkdir "C:\TEST1"

if not exist "C:\TEST1\XYZ.mdb" copy "\\PBNTFS99\SHR_access\CLO\XYZ.mdb" "C:\TEST1\XYZ.mdb" /y

Rem xcopy the latest version from server to hard drive

xcopy "\\PBNTFS99\SHR_access\CLO\XYZ.mdb" "C:\TEST1\XYZ.mdb" /y /d

start /max /HIGH C:\TEST1\XYZ.mdb
-------
I had to change the xcopy line to the following to get it to work:
copy "\\PBNTFS99\SHR_access\CLO\XYZ.mdb" "C:\TEST1\XYZ.mdb" /y
Try mapping the network drive first before your copy .. then deleting the drive after the copy

IE:

@Echo Off

Net Use :V \\PBNTFS99\SHR_access\CLO

Rem Check for local copy of XYZ.mdb - if not found, create directory and copy file.
if not exist "C:\TEST1\XYZ.mdb" mkdir "C:\TEST1"

if not exist "C:\TEST1\XYZ.mdb" copy "V:\\PBNTFS99\SHR_access\CLO\XYZ.mdb" "C:\TEST1\XYZ.mdb" /y

Rem xcopy the latest version from server to hard drive

xcopy "V:\\PBNTFS99\SHR_access\CLO\XYZ.mdb" "C:\TEST1\XYZ.mdb" /y /d

start /max /HIGH C:\TEST1\XYZ.mdb

Net Use :V /delete
-------
I had to change the xcopy line to the following to get it to work:
copy "\\PBNTFS99\SHR_access\CLO\XYZ.mdb" "C:\TEST1\XYZ.mdb" /y



Discussion

No Comment Found