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 04-20-2003, 11:08 PM   #1
teacup
Member
 
Registered: Mar 2003
Location: Rockford, Illinois
Distribution: Slackware Debian
Posts: 86

Rep: Reputation: 15
chmod problems


I want to change the permisions of files in a folder and its subfolders. I don't want the changes to affect the folders themselves. So I did:

chmod -R 600 *.txt
chmod: getting attributes of `*.txt': No such file or directory

grr...

I can do a:

chmod -R 600 *

but that will screw up all of my folders inside as well (making them non-executable). How do I do this?
 
Old 04-21-2003, 01:33 AM   #2
DoubleLetter
Member
 
Registered: Jun 2001
Location: Sharjah, United Arab Emirates
Distribution: Mandrake Linux 10.1
Posts: 132

Rep: Reputation: 15
The error: "`*.txt': No such file or directory" occurs when there are no .txt files in your CURRENT directory.

You'll have to write a bash script for the functionality you require, applying the chmod command to only files...
 
Old 04-21-2003, 12:03 PM   #3
teacup
Member
 
Registered: Mar 2003
Location: Rockford, Illinois
Distribution: Slackware Debian
Posts: 86

Original Poster
Rep: Reputation: 15
That's what I was afraid of... Thanks.
 
Old 04-21-2003, 12:53 PM   #4
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Rep: Reputation: 30
What are the permissions for your *.txt files? If they dont have an executable bit set for any user ( for example rw-r--r-- ) you can

chmod -R u=rwX,g=,o= *

and be done with it.
 
Old 04-21-2003, 03:25 PM   #5
teacup
Member
 
Registered: Mar 2003
Location: Rockford, Illinois
Distribution: Slackware Debian
Posts: 86

Original Poster
Rep: Reputation: 15
No no... the problem is they are all executable and I don't want them executable. I wanted to be able to quickly make all of them in not executable while still leaving the permisions of other files inside intact.
 
Old 04-21-2003, 05:02 PM   #6
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
# find . -name "*.txt" -exec chmod 600 {} \;
 
Old 04-21-2003, 07:33 PM   #7
teacup
Member
 
Registered: Mar 2003
Location: Rockford, Illinois
Distribution: Slackware Debian
Posts: 86

Original Poster
Rep: Reputation: 15
No, that says missing arguement to exec.
 
Old 04-21-2003, 07:52 PM   #8
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
you probably made a typo.
the {} replaces the results of the find command there,
then a space then backslash and no space before the
semi-colon
i run a command similar to that all the time.
a lot of times it's hard to see the spaces and it's
hard to know which spaces are important.
here, the really important one is lack of space
between the \and the;

yea, i just checked it.
if i add a space between the backslash and semi-colon
i get the error "missing argument to -exec"
take it out and it works.

Last edited by whansard; 04-21-2003 at 07:57 PM.
 
Old 04-21-2003, 10:59 PM   #9
teacup
Member
 
Registered: Mar 2003
Location: Rockford, Illinois
Distribution: Slackware Debian
Posts: 86

Original Poster
Rep: Reputation: 15
That was it. Woot! Out of curiosity what is the syntactical purpose of the "\;" ?

Thanks.
 
Old 04-21-2003, 11:35 PM   #10
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
i think the semicolon signifies the end of the command
for -exec, and the backslash is to keep the semicolon
from being interpreted otherwise.
just unix weirdness
 
  


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
chmod problems cerealdaemon Linux - General 2 07-22-2005 05:56 AM
chmod problems Harriskaver Linux - Newbie 8 06-04-2005 01:55 PM
CHMOD problems fritz001 Slackware 3 11-05-2004 05:15 AM
Problems with chmod and chgrp OC_eobard Linux - Newbie 13 06-08-2004 12:36 AM
samba and chmod problems... djroketboy Linux - Networking 2 08-12-2003 01:34 PM

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

All times are GMT -5. The time now is 10:17 PM.

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