LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to find directories with a space in it :P (https://www.linuxquestions.org/questions/linux-general-1/how-to-find-directories-with-a-space-in-it-p-273773/)

ToBe 01-04-2005 12:56 PM

how to find directories with a space in it :P
 
Ok, so, I had a slight mishap with a umask.. I had it set to umask 0003 for a web server (on the ftp accounts used to maintain the web server's files, actually), for all the users that work together on a single website. Anyway, that was the wrong umask (it should have been 0002 for a new directory creation of drwxrwsr-x )

So, I try the below command to reset all the directories my users have already made to the correct 775 permission:

chmod +x `find . -type d`

The problem is.. my users have been bad. They ignored my instructions NOT to use space in the directory/file name. The above command skips all the directories with space in it :(

There are hundreds of those directories... I don't want to reset them manually.. Is there a way to include escapes in the find . -type d part?

Thanks in advice for your words of wisdom... :)

T

makuyl 01-04-2005 01:32 PM

How about: find . -type d -print0 | xargs -0 chmod ugo+x

Edited to add ugo

ToBe 01-05-2005 09:47 AM

find . -type d -print0 | xargs -0 chmod 2775

That's the ticket, and it works on directories with spaces in them.. THANKS!

I am not familiar with xargs... I guess that's something that makes the directory with a space accept the chmod command :)

makuyl 01-05-2005 12:48 PM

Yep. From man xargs:

OPTIONS
--null, -0
Input filenames are terminated by a null character instead of by
whitespace, and the quotes and backslash are not special (every
character is taken literally). Disables the end of file string,
which is treated like any other argument. Useful when arguments
might contain white space, quote marks, or backslashes. The GNU
find -print0 option produces input suitable for this mode.

ToBe 01-05-2005 01:10 PM

Awesome, thanks for the schoolin'... I'll be using that command a lot now. :)


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