• Length of File Path

    From Jeff Gaines@21:1/5 to All on Thu Jun 5 07:49:00 2025
    XPost: uk.comp.homebuilt

    Why does Windows let me save a file (Little Ships return to Ramsgate) with
    a path three miles long then not let me do anything with it?

    I spent a day de-bugging my file manager before twigging the problem :-(

    --
    Jeff Gaines Dorset UK
    George Washington was a British subject until well after his 40th birthday. (Margaret Thatcher, speech at the White House 17 December 1979)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Jeff Gaines on Thu Jun 5 08:54:15 2025
    XPost: uk.comp.homebuilt

    Jeff Gaines wrote:

    Why does Windows let me save a file (Little Ships return to Ramsgate)
    with a path three miles long then not let me do anything with it?

    I spent a day de-bugging my file manager before twigging the problem :-(

    "It's always been like that, sir."

    Actually it's 'only' an Explorer issue.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Abandoned Trolley@21:1/5 to Jeff Gaines on Thu Jun 5 11:45:50 2025
    XPost: uk.comp.homebuilt

    On 05/06/2025 08:49, Jeff Gaines wrote:

    Why does Windows let me save a file (Little Ships return to Ramsgate)
    with a path three miles long then not let me do anything with it?

    I spent a day de-bugging my file manager before twigging the problem :-(



    On secrurity grounds some unix variants do not like file names which
    include spaces

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Abandoned Trolley@21:1/5 to All on Thu Jun 5 12:59:56 2025
    XPost: uk.comp.homebuilt

    1. Windows is not a Unix variant
    2. Ive not come across any unix or linux falavour that does not allow
    spaces in filenames



    OK

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to Jeff Gaines on Fri Jun 6 12:54:13 2025
    XPost: uk.comp.homebuilt

    On Thu, 6/5/2025 3:49 AM, Jeff Gaines wrote:

    Why does Windows let me save a file (Little Ships return to Ramsgate) with a path three miles long then not let me do anything with it?

    I spent a day de-bugging my file manager before twigging the problem :-(


    On an OS like Windows 7, the bug was likely left there.

    File Explorer cannot delete a MAX_PATH file. There is one precise path length that causes a problem, and then File Explorer cannot move it or delete it.
    You could write a short PERL script, and if it handled the file, it
    could delete it.

    https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

    "the maximum path on drive D is "D:\some 256-character path string<NUL>"

    On maybe a W10/W11, that was fixed. That specific path length no longer presented
    a challenge to File Explorer. It could handle 260 character paths.

    And speaking in broad general terms, files which violate the rules for filename,
    extension, or path, they generally come from browsers. Even if the browser presents
    a file saving dialog, that might not be sufficient to guarantee that some trick is
    not played.

    https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file

    "Do not end a file or directory name with a space or a period.
    Although the underlying file system may support such names,
    the Windows shell and user interface does not."

    You would expect a browser to ignore such entreaties.

    *******

    There is a feature called LongPathsEnabled (max ~32767?).

    Office does not support LongPath. File Explorer does not support LongPath.
    The OS can have LongPath enabled. Applications can be LongPathAware.
    It is apparently possible to craft exploits that are more likely to be attempted when LongPaths are present.

    The long and the short of that feature, is don't use it. In certain
    scanning scenarios, it can radically slow down the scan (junctions perhaps).

    The default on a clean install, is for that to be disabled (gives 260).

    The feature may have "existed" in the filesystem for a number of years,
    without any LongPathAware capability having been developed. The support
    at some point in Win10, is mere wallpaper, with the feature not really
    being supported in a practical way. I gather no one wants to change
    all the string definitions to handle paths that big :-) The behavior on Junctions would be egregiously bad. "Pitch the PC out the window" bad.

    Bill Gates once said "640,000 characters is enough for anyone", and he
    was right. That's why War and Peace stopped at 640,000 characters :-)
    Some of the other things Bill Gates said, such as utterances about
    MAX_PATH, were likely only said to the bathroom mirror. "If only
    we could make paths that were ridiculously long."

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to The Natural Philosopher on Fri Jun 6 17:58:57 2025
    XPost: uk.comp.homebuilt

    On Thu, 6/5/2025 11:03 AM, The Natural Philosopher wrote:
    On 05/06/2025 13:48, Joe wrote:
    On Thu, 5 Jun 2025 13:21:59 +0100
    Pancho <[email protected]> wrote:

    On 6/5/25 12:59, Abandoned Trolley wrote:

      
    1. Windows is not a Unix variant
    2. Ive not come across any unix or linux falavour that does not
    allow spaces in filenames
     


    OK

    I don't think he is contradicting you. Linux allows it, but we all
    know spaces in filenames are really annoying. So people advise
    against it.

    It depends on whether you use a command line frequently. Both Windows
    and *nix require filenames with spaces to be quoted in a command, and
    that gets tedious after a while.

    So don't use the command line


    This does not work, in Windows Powershell.

    cd My Documents

    This works in Windows Command Prompt (quotes not needed).

    cd My Documents

    For some things, they know that only one parameter is expected
    so the whole arg string is treated as a group.

    If I were writing my own utility, each "word" would be a separate arg entry. Thus, my own utility writing projects, are more likely to have double quotes around the folder I'm after.

    On Linux, you would also have to match the case of the characters.

    cd "My Documents" # works
    cd "my documents" # not work

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)