Link to home
Start Free TrialLog in
Avatar of Bardobrave
BardobraveFlag for Spain

asked on

xcopy and unc routes

Hi experts.

I'm facing some sort of strange behaviour using xcopy to move files in our network (client machines are windows 7, server is windows 2008 R2).

On an Access application I have an option to load files from client machines to a server drive. This drive has a folder where documents are stored where Access App's users have permissions, however, they haven't on the ancestors folders.

I use xcopy to move files within the Access app and it works perfectly from my windows user (as I have full access to all the path) but from client computers with other users xcopy returns an invalid drive error.

So:
xcopy "c:/myDirectoryWhatever/coolFile.pdf" "\\networkDrive\networkShare\saveToThisFolder\" /R /Y

Works from users with permissions on the full path but not on users with permissions only on saveToThisFolder.

However, if I use:
xcopy "c:/myDirectoryWhatever/coolFile.pdf" "z:\saveToThisFolder\" /R /Y

being Z a network drive built on logon on client machines it works ok.

Why don't change it on Access code? Easy... if I hardcode that drive letter we can find on the future that a change on logon scripts will blindly screw this code. Also a network drive could fail to load on logon due to network connection issues although later that issues solve, on that cases the share would be accesible but the network drive not.

Obviously give permissions on the ancestors of saveToThisFolder is not an option, as it has more folder inside where users shouldn't have access.

With all this in mind I wonder if there's some way to fix the copy of the files without having to use the network drives.
Avatar of X-treem
X-treem
Flag of Belgium image

you can do the mapping in VBA and delete the mapping after the copy
Avatar of Bardobrave

ASKER

And what about if a change on the logon scripts (that are out of my reach) maps a determinate unit letter and I'm using that unit letter for the mapping? It will produce a conflict and the system will fail.

And today that unit IS mapped on the client machines, so if I try to remap it will also fail...
there is a syntax for chekcing available drive letters...
ASKER CERTIFIED SOLUTION
Avatar of Bardobrave
Bardobrave
Flag of Spain 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
I solved it by myself