LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-12-2009, 04:03 PM   #1
b10m3ch4
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...?

Code:
[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, 04:29 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

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

Original Poster
Rep: Reputation: 0
perfect, thanks
 
Old 11-12-2009, 04:53 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
ls -l | grep -v "^d"
 
Old 11-12-2009, 05:07 PM   #5
b10m3ch4
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.
 
  


Reply



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 10:52 PM
bash: list recursively directories only kpachopoulos Programming 1 06-18-2007 02:00 AM
deleting files recursively, but not directories tantan Linux - General 2 03-07-2007 06:01 AM
List all files and recursively open directories. unreal128 Linux - General 2 07-16-2005 02:06 PM
Can ls recursively list only directories? Vosper Linux - General 3 07-16-2005 03:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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