header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Checking File Paths
Last Post 20 Nov 2008 01:39 PM by SynJunkie. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
19 Nov 2008 01:11 PM  
A common problem I have is where users have created a directory structure that exceeds 255 characters.  Although the servers allow them to do this it does cause issues with both my archiving solution and backup solution.

Is there a way to use powershell to analyse a directory structure and look for directories that exceed the limitation rather than finding out after I get a call to restore deleted data from one of these directorys.

Regards

Lee



PoshoholicUser is Online
PowerShell MVP
New Member
New Member
Posts:38
Avatar

--
19 Nov 2008 08:33 PM  
If you are working with the limitations imposed by the file system, where directory paths must be less than 248 characters in length and file paths must be less than 260 characters in length, you could find the files and folders that exceed these lengths like this:

Get-ChildItem -Recurse | Where-Object {($_.PSIsContainer -and ($_.FullName.Length -ge 248)) -or ($_.FullName.Length -ge 260)}

This will return all files and folders on the local system that exceed the lengths specified.

Note that I actually don't have any paths on my system that exceed this limitation, so I was only able to test this with some test lengths. In theory, this should work to identify which files and folders have paths that are too long. Please try it out and let me know how well it works for you.

--
Kirk Munro [MVP]
Poshohollic
http://poshoholic.com
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
20 Nov 2008 01:39 PM  
I just tested that and it works great. Thanks Kirk.
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer