# Windows cannot open directory with too long name created by Linux

My laptop has two OSes: Windows 7 and Ubuntu 10.10. A partition of Windows 7 of format NTFS is mounted in Ubuntu.

In Ubuntu, I created a directory under somehow deep path and with a long name for itself, specifically, the name for that directory is "a set of size-measurable subsets ie sigma algebra". Now in Windows, I cannot open the directory, which I guess is because of the name is too long, nor can I rename it. I was wondering if there is some way to access that directory under Windows? Better without changing the directory if possible, but will have to if necessary.

Thanks and regards!

Update:

This is the output using "DIR /X" in cmd.exe, which does not shorten the directory name:

F:\science\math\Foundations of mathematics\set theory\whether element of a set i
s also a set\when element is set\when element sets are subsets of a universal se
t\closed under some set operations\sigma algebra of sets>DIR /X
Volume in drive F is Data
Volume Serial Number is 0492-DD90

Directory of F:\science\math\Foundations of mathematics\set theory\whether elem
ent of a set is also a set\when element is set\when element sets are subsets of
a universal set\closed under some set operations\sigma algebra of sets

03/14/2011  10:43 AM    <DIR>                       .
03/14/2011  10:43 AM    <DIR>                       ..
03/08/2011  10:09 AM    <DIR>                       a set of size-measurable sub
sets ie sigma algebra
02/12/2011  04:08 AM    <DIR>                       example
02/17/2011  12:30 PM    <DIR>                       general
03/13/2011  02:28 PM    <DIR>                       mapping from sigma algebra t
o R or C i.e. measure
02/12/2011  04:10 AM    <DIR>                       msbl mapping from general ms
bl space to Borel msbl R or C
02/12/2011  04:10 AM             4,928              new file~
03/14/2011  10:42 AM    <DIR>                       temp
03/02/2011  10:58 AM    <DIR>                       with Cartesian product of se
ts
1 File(s)          4,928 bytes
9 Dir(s)  39,509,340,160 bytes free

-
Hmm, it doesn't include that extra column that includes the short version of the name (which is what it normally does -- that column is normally included just before the long filename). –  Randolf Richardson Mar 14 '11 at 15:19
Try using this tool, it may work (it's a text-mode Norton Commander clone that has native 32-bit and 64-bit Windows binaries); when you press CTRL-N in this application, it toggles between short and long filenames: farmanager.com –  Randolf Richardson Mar 14 '11 at 15:21
@Randolf: Are you using cmd.exe, command prompt, or what else for command line operations? –  Tim Mar 14 '11 at 15:21
No. Just "Cmd" is all (that would be "cmd.exe") to get to the DOS prompt. –  Randolf Richardson Mar 14 '11 at 15:22
@Randolf: Thanks! using the tool you linked I can now go into the directory with long name. If I want to open some saved files under it in other applications, what shall I do next? Do I need to rename the directory to a shorter name? If yes, under its parent directory, I still cannot "rename oldname newname". –  Tim Mar 14 '11 at 15:31

Windows has maximum filename length limitations. If you can't rename by using the short filename, then you'll have to use the Unix/Linux shell on the server to accomplish the renaming.

At the DOS prompt in Windows, if you type "DIR /X" you can see the short filenames.

-
@Randolf: Thanks! (1) I cannot even rename the directory in command window using "rename oldname newname". Any way without going back to Linux? or even better without changing the name of the directory? (2) what do you mean by "DIR /X"? I type it literally and the output is nothing different than "dir" alone. –  Tim Mar 14 '11 at 14:40
@Tim: The "DIR /X" command should include an extra column before the long filename that shows you what the short filename is. A short filename has a maximum of 8 characters for the base, and 3 characters for the suffix (preceded by the only period), and often includes the tilde ("~") character near the end of the base before at least one digit). You'll have to type "CD .. && DIR /X" if you're in the directory you wish to rename (the "CD .." command will take you up one level in the path hierarchy). –  Randolf Richardson Mar 14 '11 at 14:49
@Randolf: Thanks! (1) I cannot go into the directory with a long name, and I am now under its parent directory so I don't quite understand how "CD .. " can help here. (2) Do you mind post an example to show how to display the short name for that directory? I am still confused about how to accomplish that. Thanks! –  Tim Mar 14 '11 at 15:05
@Tim: Okay, so that directory you're trying to access is a sub-directory of your current working directory? In that case the "DIR /X" command should reveal the short name in the listing, and then you can use that short name. For example, if your short name is "THISIS~1" for a sub-directory named "This is a test," then you could use the DOS command "CD THISIS~1" to get into it, or rename it like so: REN THISIS~1 MyDir –  Randolf Richardson Mar 14 '11 at 15:08
If you'd be willing to include the output of your directory using the "DIR /X" command, I could write an example for you. –  Randolf Richardson Mar 14 '11 at 15:09

I had the same problem too. The first thing I thought was that the folder's name was too long. So, I renamed the folder using Linux but when I switch back to Windows the file inside the folder keep not open. My nub solution was to zip the folders in Linux and then unzip them from windows. So, Windows itself created all the folders all over again.

-