Casal Mendes
2003-Jun-09 16:17 UTC
[Samba] Preservation of short and long filenames in Windows 9x with Samba
I have combed the Internet for an answer to this question and I have not found it. Here's the problem. As some may know, trying to copy files with xcopy32/explorer on a Windows machine to another drive or other Windows machine DOES NOT imply that both long and short filenames will be copied exactly. eg. long filename : thisisalongfilename.txt (in Windows) short filename: THISIS~1.TXT (at the DOS command prompt)>From what I have seen, if a file is copied in Windows from one driveto another the nomenclature of both long and short filenames is preserved as long as complete directories are copied at once. The same is true if done over a network. I think the reason why this works is because the files are copied EXACTLY in the order they were created. Thus if we have the case of two filenames where: long filename : thisisalongfilename1.txt (in Windows) short filename: THISIS~1.TXT (at the DOS command prompt) long filename : thisisalongfilename2.txt (in Windows) short filename: THISIS~2.TXT (at the DOS command prompt) if the combination of thisisalongfilename1.txt/THISIS~1.TXT is copied first it will have exactly the same name on the destination drive. Likewise if the combination thisisalongfilename2.txt/THISIS~2.TXT is copied first the filenames on the destination will be WRONG! ie thisisalongfilename2.txt/THISIS~1.TXT. Note that the difference, THISIS~1.TXT should be THISIS~2.TXT. You can try this on a Windows machine to see how this works as indicated here. In my experience the combination will be copied EXACTLY as long as complete directories are copied. The question is how does SAMBA insure that the both long and short filenames are preserved exactly? This is not a frivolous question as I do not know whether/how SAMBA copies/stores both long and short filenames. Likewise any backup of a Windows directory on a Windows machine, if the files are not copied/restored in EXACTLY the same order they were created will be corrupt. (Trust me I have done this hundreds of times!) If you don't believe me look at the Windows registry to find all the short filenames embedded within!! I think that if a Windows machine sends files to the SAMBA machine the nomenclature should be preserved? But what is unclear is that since SAMBA is running a completely different operating system whether a directory request made from the Linux machine would be such that that it would mimic exactly the DOS/Windows request? The reason for this concern is for backing up entire Windows systems on a Linux machine. Thanks.