LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-11-2009, 06:00 AM   #1
zrux
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
find files which does not have 770 permissions


I need a script which can throw an error if there are files in a directory which does not have permissions of 770. this should include directores which may contain empty folders.

If there are files which dont have the permission 770 ..the script need to throw an error..

Please can someone help.
 
Old 10-11-2009, 07:30 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hi zrux and wellcome to LQ,

the find-command should work for you. Look at man find and especially for the -perm option.
Code:
find . -perm 770 -print
will find all files with this permissions. You'll have to find out then which files are not printed by the above command.
Another way to make sure that all permissions within a directory are equal to 770 would be to use chmod with the -R option (look at man chmod).

Markus

Last edited by markush; 10-11-2009 at 07:33 AM.
 
Old 10-11-2009, 01:17 PM   #3
zrux
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
thanks very much

But how do I find those files which are not printed by the above command?
 
Old 10-11-2009, 01:28 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Code:
find . -type f -perm /o=x -ls

Last edited by Tinkster; 10-11-2009 at 01:49 PM. Reason: fix-up
 
Old 10-11-2009, 03:13 PM   #5
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 2,991

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Try this:

find <path> -perm 770 > 770.txt
find <path> > all.txt
diff -d all.txt 770.txt > diff.txt


And then read diff.txt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 05:55 PM
Permissions error while copying files on NFS, but only on some files caggles Linux - Networking 1 07-30-2009 03:17 PM
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 04:45 PM
Is there a way to find recently created/edited files without using find? BrianK Linux - General 2 10-15-2007 09:41 PM
how to change exisitng files/directory permission from 755 to 770 mweil Linux - Newbie 3 07-01-2004 10:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration