LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   List all files and recursively open directories. (http://www.linuxquestions.org/questions/linux-general-1/list-all-files-and-recursively-open-directories-343775/)

unreal128 07-16-2005 01:45 PM

List all files and recursively open directories.
 
I have a directory with alot of sub-directories that store just one type of file (eg. MP3.) I want to perform a 'chmod' on only the files and not the directories. I looked through the man on `ls` but couldn't find a parameter to only list files while also listing sub-directory contents recursively. I tried using `find` in a for loop but the IFS/delimiter gets messed up since the file names include spaces. I tried assign carriage return to IFS but still got mangled output. Does anyone know how to get this to work so I can 'chmod' the files but not the directories?

druuna 07-16-2005 02:06 PM

Hi,

This should work:

find . -name "*mp3" -type f -exec chmod 640 {} \;

Hope this helps.

unreal128 07-16-2005 03:06 PM

Worked like a charm, thank you very much.


All times are GMT -5. The time now is 07:18 PM.