Data move for files with over 256 characters

SimonBrooke
New Contributor

Hi,

So finally getting rid of an old Xserve, the data is being moved to new Windows Servers.

Does anybody have a script that I can run on Snow Leopard Server that can tell me all the files and folders with over 256 characters as this will cause issues with the Robocopy.

Thanks

2 REPLIES 2

dsavageED
Contributor III

If you are moving from a macOS file store to a Windows file store you will run into more issues than just the character limit. The Mac lets users have leading and trailing spaces it also doesn't stop them using / : * ? " < > % | in their file names. We have a script in Self Service to let users fix their file names, before the files are moved to OneDrive or our fileserver. I'm not sure I would want to run it as is against a server, but it might help you out.

blenkin
New Contributor

Here is a script that you can run on Snow Leopard Server that can tell you all the files and folders with over 256 characters:

find / -type f -name "*" -exec du -h '{}' \; | awk '{if (length($NF) > 256) print $NF}'

find / -type d -name "*" -exec du -h '{}' \; | awk '{if (length($NF) > 256) print $NF}'

This script will first find all files with over 256 characters and print their names to the console. Then, it will find all directories with over 256 characters and print their names to the console.

Or you can use a tool like Gs Richcopy 360 or Long Path Tool to handle this issue easily.