Hi,
i'm wondering if someone has already wrote a script to check content files from directories if all file are no more than 256 characters long name.
If yes, i would like to display the files that need to be shortened.
thx
Hi,
i'm wondering if someone has already wrote a script to check content files from directories if all file are no more than 256 characters long name.
If yes, i would like to display the files that need to be shortened.
thx
Tech Review ➡️ https://geni.us/CQVVM
You want to print the name of all files whose filename is longer than 256 characters. Have I got this right? The following will do this for your HOME directory and everything below it. For other directories, replace ${HOME} with whatever you want.
Edit:Code:find ${HOME} | awk -F'/' '{if (length($NF) > 256) { print }}'
My mistake, I took it to mean the name only, rather than the full path. Such names cannot exceed 255 characters on most current systems. The above code checks the length of the name part, not including any path.
Last edited by spjackson; September 28th, 2015 at 11:10 AM.
You should also be able to show the files with long names using find by itself
Code:find . -regextype posix-basic -regex '.\{256,\}' -print
basically input should be the folder where i should find all filenames being more than 256 characters long (including sub directories)
Tech Review ➡️ https://geni.us/CQVVM
using something like
do the trick... except that it does not include the pathfind . -regextype posix-basic -regex '.*/.\{255,\}'
Tech Review ➡️ https://geni.us/CQVVM
I'd not sure I follow, but if you want to check just the file name, while descending into the subdirectories, you'd still need find.
But pipe it into grep so as to select only the long filenames
Code:find . | grep -P '[^/]{255,}$'
Bookmarks