UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old June 5th, 2004, 11:19 AM
nuLime nuLime is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: US
Posts: 90 nuLime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 48 sec
Reputation Power: 5
Question How do I change all permissions in one dir?

Is there a command I can use to change the permissions of every file in a certain directory? I unpacked a gzip file containing 10,000+ images which were created with permission 444 by the extractor program. I need them all to have permission 644.

How can this be done from the commandline?

Thanks!

Reply With Quote
  #2  
Old June 5th, 2004, 11:39 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
The quickest way to find stuff like this is in the man pages.

man chmod

then hit the "/" and type in "recurs" followed by enter to search the manpage for something about recursive chmods. You should find the -R switch.

chmod -R 644 /dir

-- no stress.

if you do not need to chmod any subdirectories (hence recursion), then using globs works too.

chmod 644 /dir/*

Reply With Quote
  #3  
Old June 5th, 2004, 11:46 AM
nuLime nuLime is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: US
Posts: 90 nuLime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 48 sec
Reputation Power: 5
Thumbs up

Thanks!

This is on a hosted server so we don't have access to the man pages.

Reply With Quote
  #4  
Old June 5th, 2004, 11:50 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
Well that blows! How the hell are you supposed to get anywhere without the manpages? Are they at least available in HTML format?

check here, the Linux and Solaris specific pages are available too.

http://mirrors.ccs.neu.edu/cgi-bin/unixhelp/man-cgi

Reply With Quote
  #5  
Old June 5th, 2004, 11:56 AM
nuLime nuLime is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: US
Posts: 90 nuLime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 48 sec
Reputation Power: 5
Exclamation

I am getting an "argument list too long" error when I try "chmod 664 *.jpg".

One directory had about 5,000 files, and that worked okay, but the second directory I tried with 13,000+ files gave me the argument length error.

Reply With Quote
  #6  
Old June 5th, 2004, 12:03 PM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
well, I am not sure if that is some sort of memory/buffer restriction or what. The quickest way to get around that will be to tighten up your globs. For example, you could do all the a*.jpg first. Or you could use a regex to do a-h or so. It is almost a job that warrants a small bash or perl script... .

BTW, did you try the -R. That might open things up a bit..since it is used for entire branches of the directory tree. (but be careful! )

Reply With Quote
  #7  
Old June 5th, 2004, 12:08 PM
nuLime nuLime is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: US
Posts: 90 nuLime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 48 sec
Reputation Power: 5
I think I am going to segregate the files on my end and then re-upload them. It would be easier to write a PHP script to modify our database and the location of our files than to bother with doing with every time we have to do another upload.

Reply With Quote
  #8  
Old June 5th, 2004, 05:34 PM
cr_wookie cr_wookie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 23 cr_wookie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
why don't you set up a mask and then copy the whole directory with a different name.

Reply With Quote
  #9  
Old June 5th, 2004, 09:47 PM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
That sounds good.., I'd be interested to know if it successfully avoids bottleneck that chmod suffers. What worked nuLime?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > How do I change all permissions in one dir?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway