Most of you have been using Windows OS. Have you ever tried finding, what is the length of a file name or a folder name could be? Except those who have specifically worked on File system Object (FSO) would have not bothered to know as how a file and folder name is defined in Windows OS.
Well the answer to this question is that it’s not the length of the file name or folder name; but the number of characters in the full path of the file or folder defines the max size of a file name or folder name in Windows OS. The max length of a file or folder path including itself is 255 characters (in Vista this is 260 characters).
For example, a folder name in the root of a drive (c:\ or d:\ or etc…) would be 244 characters long and a file name in the root of a drive would be 251 characters. If you have a folder name of length 244 characters long in the root drive of your hard disk, you will not be able to save a file or create a sub-folder under it. You would receive an error message “Destination path too long”.
I will end this article with few questions, which I will try to cover in my next article. Most of us have developed Document Repository System or written programs for uploading and storing files on the disk. Have you really taken care to check the file name or folder name length before uploading it to the server? How do we store files with long names? Is there any alternative apart from physical file storage on the disk?