PDA

View Full Version : file is too deep to copy?


lenny109
March 23rd 09, 04:39 PM
hi,
We have a program running from a removable HD that is plugged in via a USB
cable. (The data is stored on this drive, the program on the C drive.) I am
unable to run the program becuase it doesn't seem to be able to access the
data. However, I can access the removable drive and open all the folders on
it. I can even copy the database file but when I try to paste it to my
desktop it looks like it has pasted but after a minute or so I get an error
message telling me that it can't copy the file because the path is too deep.

I have tried sharing the removable drive, giving everybody all permissions
but it still doesn't seem to want to work properly even though I can see the
files with no problem. Elsewhere on the drive there is a folder full of word
documents. I can double click on these easily enough and they open without
any problems.

Why would it just suddenly stop working? The drive is NTFS and a Maxtor.

Pegasus [MVP]
March 23rd 09, 06:09 PM
"lenny109" > wrote in message
...
> hi,
> We have a program running from a removable HD that is plugged in via a USB
> cable. (The data is stored on this drive, the program on the C drive.) I
> am unable to run the program becuase it doesn't seem to be able to access
> the data. However, I can access the removable drive and open all the
> folders on it. I can even copy the database file but when I try to paste
> it to my desktop it looks like it has pasted but after a minute or so I
> get an error message telling me that it can't copy the file because the
> path is too deep.
>
> I have tried sharing the removable drive, giving everybody all permissions
> but it still doesn't seem to want to work properly even though I can see
> the files with no problem. Elsewhere on the drive there is a folder full
> of word documents. I can double click on these easily enough and they open
> without any problems.
>
> Why would it just suddenly stop working? The drive is NTFS and a Maxtor.

This happens because you've put a lot of information into your folder and
file names instead of the files themselves, thus exceeding the limit of
around 258 characters. To fix the problem you need to shorten your folder
names.

lenny109
March 23rd 09, 06:26 PM
Hi Pegasus,
Not this time I am afraid.The information is in
folder\2ndfolder\databasename
All the folders and file names are kept short. And nothing has changed in
the names over the last few months when everything was working OK. The files
that are used are just written over.

"Pegasus [MVP]" > wrote in message
...
>
> "lenny109" > wrote in message
> ...
>> hi,
>> We have a program running from a removable HD that is plugged in via a
>> USB cable. (The data is stored on this drive, the program on the C
>> drive.) I am unable to run the program becuase it doesn't seem to be able
>> to access the data. However, I can access the removable drive and open
>> all the folders on it. I can even copy the database file but when I try
>> to paste it to my desktop it looks like it has pasted but after a minute
>> or so I get an error message telling me that it can't copy the file
>> because the path is too deep.
>>
>> I have tried sharing the removable drive, giving everybody all
>> permissions but it still doesn't seem to want to work properly even
>> though I can see the files with no problem. Elsewhere on the drive there
>> is a folder full of word documents. I can double click on these easily
>> enough and they open without any problems.
>>
>> Why would it just suddenly stop working? The drive is NTFS and a Maxtor.
>
> This happens because you've put a lot of information into your folder and
> file names instead of the files themselves, thus exceeding the limit of
> around 258 characters. To fix the problem you need to shorten your folder
> names.
>

Spamcop User
March 23rd 09, 07:11 PM
Pegasus,

The max length is 260 defined in 'windows.h' file not 258. A few references:

http://msdn.microsoft.com/en-us/library/aa370993(VS.85).aspx
http://www.pinvoke.net/search.aspx?search=MAX_PATH&namespace=[All]

--
SPAMCOP User



"Pegasus [MVP]" > wrote in message
...
>
> "lenny109" > wrote in message
> ...
>> hi,
>> We have a program running from a removable HD that is plugged in via a
>> USB cable. (The data is stored on this drive, the program on the C
>> drive.) I am unable to run the program becuase it doesn't seem to be able
>> to access the data. However, I can access the removable drive and open
>> all the folders on it. I can even copy the database file but when I try
>> to paste it to my desktop it looks like it has pasted but after a minute
>> or so I get an error message telling me that it can't copy the file
>> because the path is too deep.
>>
>> I have tried sharing the removable drive, giving everybody all
>> permissions but it still doesn't seem to want to work properly even
>> though I can see the files with no problem. Elsewhere on the drive there
>> is a folder full of word documents. I can double click on these easily
>> enough and they open without any problems.
>>
>> Why would it just suddenly stop working? The drive is NTFS and a Maxtor.
>
> This happens because you've put a lot of information into your folder and
> file names instead of the files themselves, thus exceeding the limit of
> around 258 characters. To fix the problem you need to shorten your folder
> names.
>

Pegasus [MVP]
March 23rd 09, 09:18 PM
"SPAMCOP User" > wrote in message
...
> Pegasus,
>
> The max length is 260 defined in 'windows.h' file not 258. A few
> references:
>
> http://msdn.microsoft.com/en-us/library/aa370993(VS.85).aspx
> http://www.pinvoke.net/search.aspx?search=MAX_PATH&namespace=[All]
>
> --
> SPAMCOP User

Fascinating stuff. A moment ago I created the longest folder name that
Windows would let me. It looks like so:
C:\0123456789\0123456789\0123456789\0123456789\012 3456789\0123456789\0123456789\
0123456789\0123456789\0123456789\0123456789\012345 6789\0123456789\0123456789\012
3456789\0123456789\0123456789\0123456789\012345678 9\0123456789\0123456789\012345
6789\12>
If you count the characters then you will get 247, not 258 or 260. Ignoring
what Microsoft say, what do YOU get?

Pegasus [MVP]
March 23rd 09, 09:21 PM
"lenny109" > wrote in message
...
> Hi Pegasus,
> Not this time I am afraid.The information is in
> folder\2ndfolder\databasename
> All the folders and file names are kept short. And nothing has changed in
> the names over the last few months when everything was working OK. The
> files that are used are just written over.

The problem lies probably with the target, not with the source. Some things
to look at:
- What method do you use to copy the file?
- What is the exact error message (verbatim, please!)?
- What happens when you copy to a different target folder?
- What happens when you copy from a different source folder?

roger
March 23rd 09, 09:45 PM
I bet the file is faulty. Try to open it with another application
capable to do so, like a binary (TextPad) or Hex editor.

lenny109 wrote:
> hi,
> We have a program running from a removable HD that is plugged in via a USB
> cable. (The data is stored on this drive, the program on the C drive.) I am
> unable to run the program becuase it doesn't seem to be able to access the
> data. However, I can access the removable drive and open all the folders on
> it. I can even copy the database file but when I try to paste it to my
> desktop it looks like it has pasted but after a minute or so I get an error
> message telling me that it can't copy the file because the path is too deep.
>
> I have tried sharing the removable drive, giving everybody all permissions
> but it still doesn't seem to want to work properly even though I can see the
> files with no problem. Elsewhere on the drive there is a folder full of word
> documents. I can double click on these easily enough and they open without
> any problems.
>
> Why would it just suddenly stop working? The drive is NTFS and a Maxtor.
>
>

John John - MVP
March 24th 09, 02:10 PM
Pegasus [MVP] wrote:
> "SPAMCOP User" > wrote in message
> ...
>> Pegasus,
>>
>> The max length is 260 defined in 'windows.h' file not 258. A few
>> references:
>>
>> http://msdn.microsoft.com/en-us/library/aa370993(VS.85).aspx
>> http://www.pinvoke.net/search.aspx?search=MAX_PATH&namespace=[All]
>>
>> --
>> SPAMCOP User
>
> Fascinating stuff. A moment ago I created the longest folder name that
> Windows would let me. It looks like so:
> C:\0123456789\0123456789\0123456789\0123456789\012 3456789\0123456789\0123456789\
> 0123456789\0123456789\0123456789\0123456789\012345 6789\0123456789\0123456789\012
> 3456789\0123456789\0123456789\0123456789\012345678 9\0123456789\0123456789\012345
> 6789\12>
> If you count the characters then you will get 247, not 258 or 260. Ignoring
> what Microsoft say, what do YOU get?

Now create a file inside the folder and you will get the MaxPathLength.

The Create Directory API always reserves enough of the path length so
that 8.3 filenames (12 characters) can be appended or stored in the
directory.

The MaxPathLength is 260 characters, using your folder example:

247 characters for the folder **
+ 12 characters for the 8.3 file
+ 1 Character for the required backslash \
----
260 Characters

** The path always contains an ending nul character, your directory has
an actual path length of 248 character. If you try to create an 8.3
file in your directory the operation will fail as this would exceed the
MaxPathLength, the files in your folder will be 7.3 in length.

Another way that you could test this would be to create a file instead
of a folder in the root directory.

John

Pegasus [MVP]
March 24th 09, 02:46 PM
"John John - MVP" > wrote in message
...
>
> Now create a file inside the folder and you will get the MaxPathLength.
>
> The Create Directory API always reserves enough of the path length so that
> 8.3 filenames (12 characters) can be appended or stored in the directory.
>
> The MaxPathLength is 260 characters, using your folder example:
>
> 247 characters for the folder **
> + 12 characters for the 8.3 file
> + 1 Character for the required backslash \
> ----
> 260 Characters
>
> ** The path always contains an ending nul character, your directory has an
> actual path length of 248 character. If you try to create an 8.3 file in
> your directory the operation will fail as this would exceed the
> MaxPathLength, the files in your folder will be 7.3 in length.
>
> Another way that you could test this would be to create a file instead of
> a folder in the root directory.
>
> John

Great - thanks for the clarification. Perhaps you also know the answer to
this nagging question: Since NTFS supports file+folder name lengths of up to
32k characters, why is it that most applications (with the exception of a
handfull such as ntbackup.exe and robocopy.exe) are still restricted to 260
characters? This continues to be an irritating issue to some people -
questions about excessive path lengths pop up here with great regularity. Is
Vista subject to the same limitation?

John John - MVP
March 24th 09, 07:05 PM
Pegasus [MVP] wrote:
> "John John - MVP" > wrote in message
> ...
>> Now create a file inside the folder and you will get the MaxPathLength.
>>
>> The Create Directory API always reserves enough of the path length so that
>> 8.3 filenames (12 characters) can be appended or stored in the directory.
>>
>> The MaxPathLength is 260 characters, using your folder example:
>>
>> 247 characters for the folder **
>> + 12 characters for the 8.3 file
>> + 1 Character for the required backslash \
>> ----
>> 260 Characters
>>
>> ** The path always contains an ending nul character, your directory has an
>> actual path length of 248 character. If you try to create an 8.3 file in
>> your directory the operation will fail as this would exceed the
>> MaxPathLength, the files in your folder will be 7.3 in length.
>>
>> Another way that you could test this would be to create a file instead of
>> a folder in the root directory.
>>
>> John
>
> Great - thanks for the clarification. Perhaps you also know the answer to
> this nagging question: Since NTFS supports file+folder name lengths of up to
> 32k characters, why is it that most applications (with the exception of a
> handfull such as ntbackup.exe and robocopy.exe) are still restricted to 260
> characters? This continues to be an irritating issue to some people -
> questions about excessive path lengths pop up here with great regularity. Is
> Vista subject to the same limitation?

Thats something that someone who knows about programing could answer
better than I can. I can only guess that for compatibility reasons most
applications and operating system utilities use the standard APIs to
create files and folders and that they respect this old 260 character
path length, probably many of the applications out there would choke
trying to work with files outside the path length limits. As you say,
the actual limit on NTFS is about 32,000 characters. Some applications
can and do on occasion create paths in excess of the 260 character
limit, Internet Explorer, Media Player and other third party programs
can create these long paths. As for Vista I'm not sure and I don't have
a test box to try it.

John

Google