[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to sort files in a directory?



Rodolfo Medina wrote:
Hi.

I want to sort all files with, say, .txt extension that are in the directory
`/path/to/dir' and all its subdirectories, and I want to perform this search
starting from the directory itself: how can I do that?

I didn't manage with `find'.

Thanks for any suggestion
Rodolfo

e.g.: suppose that in my home directory there are dir1 and dir2 and the
following files:
~/file ~/dir1/file1 ~/dir/file2
I want the result of my search to be:
file
file1
file2



how about something like this:

find /path/to/dir* -maxdepth 2 -type f -name "*.txt" -print | rev | awk -F/ '{print $1}' | rev

--
8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno.


Reply to: