Forum Home
Press F1
 
Thread ID: 38280 2003-10-02 10:13:00 Listing Specific files in a directory Chilling_Silently (228) Press F1
Post ID Timestamp Content User
179819 2003-10-02 10:13:00 'Evening all

Im after a way to list files in a folder with filenames that are over 42 Chars long.

They all vary in filename length, but all end with the same extension if it helps.

I'd prefer if the output were generated into a txt file... how would I go about doing this?
Is it actually possible?

I can do it in either Doze or Linux, Pref Linux thou.

Cheers


Chill.
Chilling_Silently (228)
179820 2003-10-02 10:24:00 dir >> file.txt

Will give a listing and append it to that file.
-=JM=- (16)
179821 2003-10-02 10:58:00 Hmm.. That's sorta what I was after.

No fear though, I've got it sorted in Linux:
ls ?????????????????????????????????????*.mp3 > ~/mp3s

Thanks for that though, I never new you could do that with dir, so I'll keep that in mind!

Thanks JM :-)
Chilling_Silently (228)
179822 2003-10-02 11:12:00 You can do the same with any standard command. Just use ">>" which will create a new text file or append to the bottom of the existing one, or use ">" if you want to create a new one or wipe an existing one. -=JM=- (16)
179823 2003-10-02 13:32:00 In Linux this will do the trick:

ls | grep '.\{42,\}' > myfile

42 would be the absolute length including the period and ext so you'd probably have to put in 46.
pompeymike (4601)
179824 2003-10-02 13:53:00 I was origionally thinking I would have to pipe it to grep, so it would appear there is far more than one way to skin this cat! Chilling_Silently (228)
179825 2003-10-03 06:26:00 There are least 42 ways to do it. :D

awk (gawk), perl, etc will do it too.
Graham L (2)
1