Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-12-2009, 05:03 PM   #1
LQ Newbie
Registered: Nov 2009
Posts: 17

Rep: Reputation: 0
List all files in a directory recursively, without the directories?

For the purposes of shell scripting, is there a command that will list all the files in a directory recursively without listing the directories?

For example: in the directory below, I can ls the contents of the directory, but how would I get all the file names, of even the files in the included directories, but not those directories...?

[root@gw4 ~]# cd /var/log
[root@gw4 log]# ls
acpid            boot.log    cups     mail        pm            secure    yum.log
anaconda.log     btmp        dmesg    maillog     ppp           spooler
anaconda.syslog  conman      faillog  mcelog      prelink       tallylog
apf_log          conman.old  httpd    messages    pureftpd.log  wtmp
audit            cron        lastlog  mysqld.log  rpmpkgs       xferlog
[root@gw4 log]#
Old 11-12-2009, 05:29 PM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,701

Rep: Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566
find /path -type f
Old 11-12-2009, 05:42 PM   #3
LQ Newbie
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
perfect, thanks
Old 11-12-2009, 05:53 PM   #4
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735
ls -l | grep -v "^d"
Old 11-12-2009, 06:07 PM   #5
LQ Newbie
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
That works too. The exact results I am trying to get is with the full path, and the file name, so I can perform and action on each file. I am experimenting with this now, but no luck so far.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to list all files recursively, in a non-broken list? nyle Linux - Newbie 1 12-16-2008 11:52 PM
bash: list recursively directories only kpachopoulos Programming 1 06-18-2007 03:00 AM
deleting files recursively, but not directories tantan Linux - General 2 03-07-2007 07:01 AM
List all files and recursively open directories. unreal128 Linux - General 2 07-16-2005 03:06 PM
Can ls recursively list only directories? Vosper Linux - General 3 07-16-2005 04:57 AM

All times are GMT -5. The time now is 11:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration