Link to home
Start Free TrialLog in
Avatar of REIT
REIT

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of Brad Groux
Brad Groux
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Spike99
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.
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. User generated image
Avatar of zulazen
zulazen

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

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:

User generated image
Avatar of REIT

ASKER

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.