WindowsError: [Error 206] The filename or extension is too long:

Reply

Join Date: Nov 2008
Posts: 3
Reputation: kamaksha1 is an unknown quantity at this point 
Solved Threads: 0
kamaksha1 kamaksha1 is offline Offline
Newbie Poster

WindowsError: [Error 206] The filename or extension is too long:

 
0
  #1
Nov 19th, 2008
Hi.. I've to remove a very long path. I've written the below to try that but its giving WindowsError: [Error 206] (I've pasted it below). I've prepended "\\?\" to the actual path but still I'm getting the exception. Please let me know the solution...
++++
import os
import shutil

os.rmdir(os.path.realpath(r"\\?\D:\Kamesh\test-1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950\test-1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950\kkkkkkkkkkkkkkkkkkkkkkkkk\kllkppppppppppppp\long_path_test"))
++++++++++++++++


++++++++++
WindowsError: [Error 206] The filename or extension is too long: '\\\\?\\D:\\Kam
esh\\test-1234567891011121314151617181920212223242526272829303132333435363738394
041424344454647484950\\test-1234567891011121314151617181920212223242526272829303
132333435363738394041424344454647484950\\kkkkkkkkkkkkkkkkkkkkkkkkk\\kllkpppppppp
ppppp\\long_path_test'
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 3,983
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 926
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: WindowsError: [Error 206] The filename or extension is too long:

 
0
  #2
Nov 19th, 2008
Are you trying to store your data in the file path?
Please read the Windows manual on file path limitations.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,146
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: WindowsError: [Error 206] The filename or extension is too long:

 
0
  #3
Nov 19th, 2008
Path cannot be more than 255 chars on NT based systems using NTFS
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 3
Reputation: kamaksha1 is an unknown quantity at this point 
Solved Threads: 0
kamaksha1 kamaksha1 is offline Offline
Newbie Poster

Re: WindowsError: [Error 206] The filename or extension is too long:

 
0
  #4
Nov 20th, 2008
Originally Posted by vegaseat View Post
Are you trying to store your data in the file path?
Please read the Windows manual on file path limitations.
Thanks for your valuable suggestion.

I have to remove too long path created by some scripts of our project... I've just taken an example to try it out. Please don't validate the path given in the example and that is not the data as you assumed...

I did search in google but couldn't find the exact solution..
just let me know the solution if you have any solution..
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 3
Reputation: kamaksha1 is an unknown quantity at this point 
Solved Threads: 0
kamaksha1 kamaksha1 is offline Offline
Newbie Poster

Re: WindowsError: [Error 206] The filename or extension is too long:

 
0
  #5
Nov 20th, 2008
Originally Posted by jbennet View Post
Path cannot be more than 255 chars on NT based systems using NTFS
Yeah.. you are right.. in some cases where the path exceeds 255 chars, we can prepend '//?/' so that it allows around 3000 chars and then we can remove it.. but still i think i've missed something in the script..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC