The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
file extensions in a directory structure itsritish Shell Programming and Scripting 4 07-24-2009 07:23 AM
link scripts to file extensions for tab completion pyramation Shell Programming and Scripting 0 07-11-2009 11:35 PM
Batch changing file extensions cdines Shell Programming and Scripting 5 05-19-2008 05:11 AM
Truncate multiple file extensions prvnrk Shell Programming and Scripting 12 04-04-2008 10:20 AM
File name extensions thurrock Shell Programming and Scripting 2 11-07-2001 01:05 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 2 Weeks Ago
ganga.dharan ganga.dharan is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 41
File extensions in a dir

Hi All,

Is there a way to list all file extensions in a directory and its recursive dirs?

Thanks
  #2 (permalink)  
Old 2 Weeks Ago
jgt jgt is offline
Registered User
  
 

Join Date: Apr 2007
Location: 44.21.48N 80.50.15W
Posts: 439
I was going to say "find ./ -name *.doc -print" but on second reading, do you want a list of all the unique extensions?

Last edited by jgt; 2 Weeks Ago at 07:00 PM..
  #3 (permalink)  
Old 2 Weeks Ago
ganga.dharan ganga.dharan is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 41
it's not only *.doc.. dir might contain any file exntensions.. I just thought to list just the file extensions..

---------- Post updated at 06:28 AM ---------- Previous update was at 04:18 AM ----------

for ex:

directory1
------->a.java
------->sdd.txt
------->dcdssss.sh
------->dir2_inside_dir1
--->damcda.cckkk
--->cdcnld.abc

So what i am looking is actually to tell me the file extns in directory1
java,txt,sh,cckkk,abc
  #4 (permalink)  
Old 2 Weeks Ago
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,420
Code:
find /path/to/ -type f | awk -F\. '$NF !~ /^\//{a[$NF]++}END{for(i in a)print i}'
  #5 (permalink)  
Old 2 Weeks Ago
Scrutinizer Scrutinizer is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 597
Code:
find ./ -type f|sed -n 's/.*\///;s/.*\.//p'|sort -u

Last edited by Scrutinizer; 2 Weeks Ago at 11:12 PM..
  #6 (permalink)  
Old 2 Weeks Ago
ganga.dharan ganga.dharan is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 41
thanks danmero and scrutinizer,, ur soln works great..
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0