473,804 Members | 3,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Jun 27 '08 #1
2 1946
On Wed, 21 May 2008 04:56:02 -0700, Jesper, Denmark
<Je***********@ 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
Jun 27 '08 #2
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" <Je***********@ discussions.mic rosoft.comwrote in message
news:A3******** *************** ***********@mic rosoft.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.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
7729
by: Erik Schulp | last post by:
Hi all, I am using a background image via a stylsheet. I've used this code: background-image:url("/images/tile.gif"); (which I think is correct) The image doesn't show up however, the path, the filename etc etc, everything checks out ok.
67
4288
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
5
1321
by: Lenny G. | last post by:
Suppose I have a python module named Hippo. In the Hippo module is a class named Crypto. The Crypto class wants to 'from Crypto.Hash import SHA' which refers to the module/classes in python-crypto. Other classes in the Hippo module want to 'import Crypto' referring to Hippo.Crypto. How do I do this? For now, I just renamed my Hippo.Crypto to Hippo.HippoCrypto and everything is okay as long as I use 'HippoCrypto' to refer to that...
4
4033
by: Aashish Patil | last post by:
Hello, Is it possible to obtain the fully qualified name of a class in c#. What I am looking for is something analogous to Box.class.getName() that exists in Java. Its possible to get this by calling GetType() on an instance but I need to do this in a static method of the same object whose fully qualified name is needed. Thus, there is no instance available on which the GetType()
5
3021
by: fc2 | last post by:
Hi I have a problem with fully qualified names. According to the C# language specification: "Every namespace and type has a fully qualified name, which uniquely identifies the namespace or type amongst all others." However, I have problems compiling the following:
6
2587
by: I am Sam | last post by:
I keep getting this error and I don't know why: The path is too long after being fully qualified. Make sure path is less than 260 characters. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.PathTooLongException: The path is too long
2
3886
by: Seth | last post by:
Ok, here is my setup. I have a fully functioning HTTP Handler implemented. The handler is supposed to handle every single request that comes in to a particular virtual directory. Thus, in IIS, I have a mapping of .* to the aspnet_isapi.dll. And my web.config has an entry thusly: <add verb="*" path="*" type="HandlerClass, HandlerAssembly" /> And this is working just fine thus far. The handler gets all the requests and works like a...
3
3207
by: Zenu | last post by:
Hi, I have a system with very long paths and I'm trying to use file.exist(Longpath) to test the paths existance but it gives a message that the path is too long. Can someone tell me how to manupulate long path in VB.NET. I am refering to fully qualified paths over 32000 characters where each component of the path could be up to 255 characters.
1
2328
by: Erland | last post by:
Hi all, As per my understanding in order to load an assembly using Assembly.Load() you have to provide fully qualified name of the assembly you are trying to load e.g. Assembly asmb=Assembly.Load("System.Windows.Forms,Version=1.0.5000.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"); In this case i will have to provide the whole big string in
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.