Re: How to sort files in a directory?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 02/24/08 11:54, Wayne Topa wrote:
> Rodolfo Medina(rodolfo.medina@gmail.com) is reported to have said:
>> 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
>
> ls file*/*.txt |sort
But that's not generic to an arbitrary directory depth. You'll have
to go to Perl or Python to do such a task.
See, whereas DOS, CP/M and their progenitors the DEC minicomputer
OSs have the concept of file node, device, directory, name & type,
Unix only has node, directory & name. There is no "type". Thus
*certain* tasks which are trivial in the PC world need work-arounds
in the Unix world.
- --
Ron Johnson, Jr.
Jefferson LA USA
"(Women are) like compilers. They take simple statements and
make them into big productions."
Pitr Dubovitch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHwbPiS9HxQb37XmcRAptyAJoCdF+Xnbgs/tbfzdDCyq3TAQel5gCfU6+g
CC2vueuv7OvTGPpqUUcBjgU=
=BUPq
-----END PGP SIGNATURE-----
Reply to: