LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   List all files in a directory recursively, without the directories? (http://www.linuxquestions.org/questions/linux-general-1/list-all-files-in-a-directory-recursively-without-the-directories-768757/)

b10m3ch4 11-12-2009 05:03 PM

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]#


AlucardZero 11-12-2009 05:29 PM

find /path -type f

b10m3ch4 11-12-2009 05:42 PM

perfect, thanks

pixellany 11-12-2009 05:53 PM

ls -l | grep -v "^d"

b10m3ch4 11-12-2009 06:07 PM

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.


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