![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
chmod -R 755 *.cgi
Why does this command NOT work?
chmod -R 755 *.cgi chmod: getting attributes of `*.cgi': No such file or directory I want to recursively change every .cgi file to 755. Is there no way to do a wildcard and recurse at the same time with chmod? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: May 2002
Location: Malaysia
Posts: 3,376
|
Looks like you need to recurse and wildcard before you chmod the .attribute.
If you chmod the 755 back to 745 it will also.
__________________
"In a Time of Universal Deceit, Telling the Truth is a Revolutionary Act." - George Orwell |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
You mean like this?
chmod -R *.cgi 755 chmod: invalid mode string: `*.cgi' |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Join Date: Nov 2001
Posts: 711
|
Quote:
directories aren't *.cgi so the -R won't help, it won't get into the directories.... that's why it didn't work, but i don't know what should work, i almost have no clue about *nix .... so if you find the answer... please share it with us ;) |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
I think you are right. How do I tell it to recurse a directory (the current directory) and apply the *.cgi wildcard at the same time?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Macdaddy coder
Industry Role:
Join Date: Feb 2002
Location: MacDaddy pimp coder
Posts: 2,806
|
.
__________________
MacDaddy Coder. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
[edit]
I was wrong. This command does NOT work.: chmod -R 755 . *.cgi It changes ALL files. Same as running this command: chmod -R 755 . |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Macdaddy coder
Industry Role:
Join Date: Feb 2002
Location: MacDaddy pimp coder
Posts: 2,806
|
Told u
. ![]()
__________________
MacDaddy Coder. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Nope, I was wrong. That above command CHANGES ALL FILES just as running "chmod -R 755 ." would do.
FUCK! ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Anyone know how to do this? If it can not be done, I am going to have to code a script to do this because I have way too many files to manually change.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Dec 2001
Location: Malibu
Posts: 3,817
|
Hi,
cd to the directory and type: find -name '*.cgi' -exec chmod 755 {} \; Hope this helps. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Join Date: Feb 2002
Location: Seattle
Posts: 1,070
|
to summarize, keep this in mind.
your shell is what does the wildcard expansion. so when you type: chmod -R 755 *.cgi your shell expands *.cgi to a list of the files in the current directory that end with .cgi . this would also include directories (which are basically files) that happened to be named something.cgi . only after the expansion is done are the arguments actually sent to chmod. some shells will error out if there are no .cgi files. other shells (better shells) wil just pass '*.cgi' on to the chmod binary. chmod doesn't understand wildcards (most binaries don't, find is an exception) so it would try to change the permissions on a file called '*.cgi'. if that file was a directory it would change them recursively. fuqalot's post is correct. i'm just clarifying why this happens.
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Thanks for explaining how it works salsbury, that helps a lot. So wildcards and recursing are exclusive, which is what I thought, I just did not know exactly why.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 | |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Quote:
BTW, the "{}" is the list of files that find returns, right? What is the "\" for? |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 | ||
Confirmed User
Join Date: Dec 2001
Location: Malibu
Posts: 3,817
|
Quote:
Quote:
|
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 |
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Excellent. Thanks again.
|
![]() |
![]() ![]() ![]() ![]() ![]() |