chmod a lot of files

So i have about 600gb of data.. in which there are alot of directories and alot of files.. Im trying to put this on a ftp server.. So i want to set the permissions on the directories to be 755 and the permission on the files to be 644. So i used:

find . -type d -exec chmod 755 {}\;

and

find . -type f -exec chmod 644 {}\;

The command for the files seemed to work on the majority of the files.. But the one for directories worked for like 30% of my diretories.. Can you guys recommend another way of doing this.. To make sure "all" my files are set to 644 and "all" my directories are set to 755... Thanks :slight_smile:

What is the current permission of files that are not getting changed?

777 :frowning:

In my system if I do not give a space after {}, it throws an error. so try to check it.
use -print and see what files are getting changed.
from which dir are you running the command.

from the main folder

Maybe spaces in the names? maybe too many execs ?

find . -type d -print | while read DIR
do
         chmod 755 "${DIR}"
done

find . -type f -print | while read FILENAME
do
         chmod 644 "${FILENAME}"
done

Afterthought: If any of the directories are links, you may need the "-follow" parameter to "find".

that work thank u very much :slight_smile: