Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Copying files with long paths

$
0
0

I created a vbscript to copy files and I am running into a problem with files with long paths. I created a sub that will go through a folder, copy all files in the folder to a different location, then recursively call itself for any subfolders. Everything is set to use the file system object. It works fine until it reaches a path over 260 characters. According to the logging, if the folder path is over 260 characters it does not show up as a SubFolder property in a folder object.

I did find the MSDN article below about the MAX_PATH property. I tried to add the //?/ string to the beginning of the paths. I could then properly get all items from the SubFolder property. However, I can’t get the files to copy using either the standard path or adding //?/ to the beginning of the path. I have tried using both the file system object and the CopyHere method of the shell both without success. I know that I can map drives to shorten the paths or use the subst command, but I would like to avoid that if possible. I would like to be able to do this copy without having to call an external application, but I can’t figure out any way to do this. 

Is there any way to perform this copy in vbscript without calling an external application or substituting a drive letter? The script is going to run from a combination of XP, 2003, and 2008 machines.

 http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>