LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-04-2005, 12:56 PM   #1
ToBe
Member
 
Registered: Aug 2003
Distribution: RHEL 4&5 Ubuntu LTS 6.06 & 8.04, FreeBSD
Posts: 74

Rep: Reputation: 20
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
 
Old 01-04-2005, 01:32 PM   #2
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

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

Edited to add ugo

Last edited by makuyl; 01-04-2005 at 01:38 PM.
 
Old 01-05-2005, 09:47 AM   #3
ToBe
Member
 
Registered: Aug 2003
Distribution: RHEL 4&5 Ubuntu LTS 6.06 & 8.04, FreeBSD
Posts: 74

Original Poster
Rep: Reputation: 20
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
 
Old 01-05-2005, 12:48 PM   #4
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 54
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.
 
Old 01-05-2005, 01:10 PM   #5
ToBe
Member
 
Registered: Aug 2003
Distribution: RHEL 4&5 Ubuntu LTS 6.06 & 8.04, FreeBSD
Posts: 74

Original Poster
Rep: Reputation: 20
Thumbs up

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find, over quota directories branden_burger Programming 2 11-07-2005 10:34 AM
VMWare Can't Find Init Directories glennt11 Linux - Software 2 10-23-2004 08:23 PM
restrict space for some users in directories CleonII Linux - Security 5 02-25-2004 10:08 AM
Where to find/How to change .h include directories for g++ sfcesario Linux - Software 1 01-31-2004 10:12 AM
Where can I find a good help page on directories? Travis86 Linux - Newbie 3 01-04-2003 10:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration