Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Long file path problem

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64913
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Long file path problem
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Long file path problem - 10/8/2008 5:11:28 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
When users create files on the server where the length of the file path and file name together exceed 256 characters, problems occour when they try and access the file again. The trick to fix this is to map a drive further down the directory tree and then rename the problem files to something shorter.

I wrote a script to detect these problematicly long file names but ironically it appears to fall over when coming to one of these files.

I wrote it using file system object code because wmi falls over on { and ' characters.

Can anyone suggest anything or already has a script that does this?

Cheers


      

< Message edited by TomRiddle -- 10/8/2008 5:13:33 PM >
 
 
Post #: 1
 
 RE: Long file path problem - 10/9/2008 12:06:40 AM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
quote:

ORIGINAL: TomRiddle

I wrote it using file system object code because wmi falls over on { and ' characters.


If WMI would work for you you may look at the frequently asked stuff post which has an example of getting over { & ' in WMI queries
http://www.visualbasicscript.com/m_47117/tm.htm

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TomRiddle)
 
 
Post #: 2
 
 RE: Long file path problem - 10/9/2008 5:30:13 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
 
Hi DM_4ever,
 
Thanks for your tip.
 
I have now started to rewrite the script using a RoboCopy command to generate a file containing the complete directory listing of all files on the share. Then it will be a simple thing script a report of all paths in that file that are longer than 256 char.
 
I tried the technique in the FAQ but just could not get it to work, if I manually type a path in with a ' in it, it works with that technique. But I punch in a path as a variable it fell over. So did not get past that. I imagine WMI would suffer the same ANSI 256 char MAX_PATH  limitation. What I need is unicode version of these type of functions but could not find examples. RoboCopy is unicode compatible.
 
I will post the script that uses RoboCopy later and another one that uses just pure vbscript if someone can come up with unicode compatible code sample.
 
 
 
 _________________________________________
 
 Avada Kedavra

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Long file path problem - 10/9/2008 11:44:53 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
Robocopy is just used here to get a listing of files as it can read past the MAX_PATH barrier


      

< Message edited by TomRiddle -- 10/12/2008 1:53:00 PM >

(in reply to TomRiddle)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Long file path problem Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts