I am trying to look at a directory named Forever
where it has sub-directories with Pure
,Mineral
which are filled with .csv
files. I was able to see all the .csv
files in the directory, but I am having hard time sorting them according to the length of filename.
As for current directory, I am at Forever
. So I am looking at both sub-directories Pure
and Mineral
.
What I did was:
find -name ".*csv" | tr ' ' '_' | sort -n -r
This just sorts the file reverse alphabetically, which doesn't consider the length.(I had to truncate some name of the files as it had spaces between them.)