Long fully qualified filenames

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?=

    Long fully qualified filenames

    Hi,
    I work in a company where we tend to use very deep folder structures and
    long descriptive file names due to the nature of the analysis that we make.

    I've made a program that recursively descends into these folders to do some
    search stuff. However, I receive an exception trown from a FileInfo object
    when I'm deep down the mine shaft saying that "the specified path/file is too
    long and must not exceed 248/260 respectively in characteres". Before I start
    to work on some workaround, does anyone know of a way to use loooooong
    filenames/paths?

    regards
    Jesper.
  • Peter Duniho

    #2
    Re: Long fully qualified filenames

    On Wed, 21 May 2008 04:56:02 -0700, Jesper, Denmark
    <JesperDenmark@ discussions.mic rosoft.comwrote :
    I've made a program that recursively descends into these folders to do
    some
    search stuff. However, I receive an exception trown from a FileInfo
    object
    when I'm deep down the mine shaft saying that "the specified path/file
    is too
    long and must not exceed 248/260 respectively in characteres". Before I
    start
    to work on some workaround, does anyone know of a way to use loooooong
    filenames/paths?
    Well, one approach would be to iteratively set
    Environment.Cur rentDirectory to descend into the directory structure and
    then specify paths relative to the current directory instead of using full
    pathnames.

    One thing to keep in mind though: even within Windows, you will run into
    situations where it doesn't handle deep directory structures well. If you
    can, it might be worthwhile to adjust the layout of your data to avoid the
    problem (or possibly use OS-level techniques like the "subst" command to
    shorten the paths).

    Pete

    Comment

    • Jeff Winn

      #3
      Re: Long fully qualified filenames

      Windows MAX_PATH is 260 characters if i recall, filenames are supposed to be
      a short description of the file so you can find them easily. They're not
      designed to store the whole file in the filename and leave the file empty.

      You could always store the files in a database of some sort to categorize
      the information and use a guid for the filename. Didn't give us any
      information about the project so i'm really just guessing at this point. At
      any rate, if the filenames are starting to exceed max path, you need to
      rethink how you're building your file system and fix it.

      "Jesper, Denmark" <JesperDenmark@ discussions.mic rosoft.comwrote in message
      news:A314145E-60E1-4DD9-8966-DEE57757DDC1@mi crosoft.com...
      Hi,
      I work in a company where we tend to use very deep folder structures and
      long descriptive file names due to the nature of the analysis that we
      make.
      >
      I've made a program that recursively descends into these folders to do
      some
      search stuff. However, I receive an exception trown from a FileInfo object
      when I'm deep down the mine shaft saying that "the specified path/file is
      too
      long and must not exceed 248/260 respectively in characteres". Before I
      start
      to work on some workaround, does anyone know of a way to use loooooong
      filenames/paths?
      >
      regards
      Jesper.

      Comment

      Working...