How could I find directories with the name of specific length?
For example, I have bunch of directories which have length of the name equal to 33 chars ('a92e8cc611fdebcca3cf2fc8dc02c918', 'c442fb3f46d6c8bd17d27245290a9512' and so on).
Does find utility accepts condition in form of the 'wc -c'? Or maybe some other utilities should be piped together?
How to find directories with the name of specific length
4.1k Views Asked by altern At
4
There are 4 best solutions below
2
On
You don't have a Java tag, but if you did you'd write a FileFilter to encapsulate whatever criteria you have in mind and pass it to the java.io.File.list() method. If you want to traverse the entire directory structure tree you'll have to recurse, but it's entirely doable.
Sorry, it's just not *nix scripting.
The Apache Commons IO JAR has some nice file and directory utilities that could make this an easy job.
few ways with GNU find