-   Linux - General (
-   -   List all files and recursively open directories. (

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


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 06:43 PM.