File Length Query

Hi Guys

Is there a way of running a report or using a tool which will tell a user which files are about the exceed the Windows Maximum file length. Reason i'm asking is a user has just had an issue where she couldn't open or move a file due to its name being too big and they want to mitigate this before it happens again.
LVL 13
RizzleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad GrouxSenior Manager (Wintel Engineering)Commented:
The maximum length allowed for full network or storage paths is 260 characters - http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath
Maximum Path Length Limitation
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. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character.

As far as I know there isn't any PowerShell command or Windows integrated tool that will allow you to check for the current length. However there is a stand-alone freeware tool that may be of some help - http://www.softpedia.com/get/System/File-Management/Path-Length-Checker.shtml

Please note, I've never used this tool so your mileage may vary.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Spike99On-Site IT TechnicianCommented:
When I want to see if a path is getting close to the path name limit, I copy & paste the full folder path into a blank Word document (I use Word 2010),  then I click on the Review tab.  Under the Proofing section of the Review tab, click on the "Word Count" button: that will tell you the number of characters with & without spaces.

In Word 2003 & earlier, I think you could find that Word Count item under the Tools menu.
0
Brad GrouxSenior Manager (Wintel Engineering)Commented:
Word actually just gives you the word count in the bottom left of the screen and has since Word 2007, opposite the zoom controls. If you don't see it by default you may have turned off the feature somehow. D--Temp-Words.png
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

zulazenCommented:
Here's how you can check the length in powershell for a file or path:

First, create a variable in powershell:

$path = c:\windows\system32\drivers\etc\hosts

Open in new window


Then, find the length of your variable:

$path.length

Open in new window



If you would like to script this to check all the files in a directory, try this:

$files = gci c:\windows\system32\drivers\etc | select -ExpandProperty name

foreach($file in $files){

$filelength = $file.length

echo "$file, $filelength"

}

Open in new window

0
Spike99On-Site IT TechnicianCommented:
Brad,

I wasn't talking about the word count displayed in the status bar at the bottom: there is no way that I know of to make that display the character count.

To see the full word & character count, paste the path of the file into Word. Then, click on the "Review" tab and then click on the "Word Count" button to see the full Word Count statistics. This will include the number of characters with & without spaces. This is a screenshot from a full Word document, so the count is way over the path name limit, of course:

Screenshot of the Word Count dialog in Word 2010
0
RizzleAuthor Commented:
I will try your suggestions and let you know guys :), but due to the amount of files and folders the word document one wouldnt be the best solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.