How long the filename can be?

A friend asked me a very simple question.
And lucky me I had a computer in front to check my answer before telling him something stupid.
The question was: "I am on a Windows 7 machine. And it looks like I am not able to put my files in a deep subfolder. How many characters are allowed in a Windows 7 path?".
My first thought was to say: "around 32k". Before saying I've checked the info and it looks I was wrong.
The 32k is ok for the filesystem but the operating system is a different story. According to MSDN

"In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters."

This is definitely something to keep in mind when you work with lots of files folders and data in general.

No comments: