Link to home
Start Free TrialLog in
Avatar of zeotech
zeotechFlag for United States of America

asked on

PowerShell to create list of files & folders over 255 characters

I need a Powershell script to search a folder (d:\public\records) and output of a list of all of the files that have a combined path (directory path + filename) of over 255 characters.

WHY?
I am using RichCopy to transfer 1TB of data from server to server.  RichCopy crashes due to the file length limits. I must use RichCopy as it is the only tool that fulfills all of the requirements for this project. The directory I am checking contains a lot of data in tens of thousands of folders so workarounds like mapping a network drive to shorten the path will not work, there are just too many and I am not even sure where they are.

THANKS!
ASKER CERTIFIED SOLUTION
Avatar of Bryan Butler
Bryan Butler
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 zeotech

ASKER

SOLUTION
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
Just remember it doesn't check under dirs that are too long:

// Check if the directory length is valid, if the            
// directory is too long then there is no point testing            
// the sub folder/files until this is fixed.            

Also in the code:

* I doubt What I have done is a good way of doing it, but    
* works enough - if you have a better idea please go ahead.

I think my one liner was better as it checks all the files.
Avatar of zeotech

ASKER

Between this suggestion and the other code i can get the desired result.