[Cialug] List file types in a directory
Matthew Nuzum
matthew.nuzum at canonical.com
Thu Mar 8 16:18:45 CST 2007
On Thu, 2007-03-08 at 16:14 -0600, Daniel Juliano wrote:
> So, how would I get a list of file types for all files in a directory?
> Let's say I've got the following:
> test1.txt
> test2.txt
> test3.jpg
>
> I'd like something similar to:
> .txt
> .jpg
>
> Any ideas?
someone can do better, or improve on this, but you could start with:
ls -1 | cut --delimiter . -f 2 | sort
That assumes only one dot per filename and doesn't remove duplicates.
that's ls -<number one, not letter L> by the way.
--
Matthew Nuzum
newz2000 on freenode
More information about the Cialug
mailing list