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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-15-2007, 09:28 AM   #1
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
Help with chmod

How do I change filepermission for all .jpg images, folders and subfolders?

I want to change to 0777 for a short period while a script make some changes (some images have different owners) and then back to normal again.

After the script is finished I want all folders to be 0755 and all .jpg images to be 0644.
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-15-2007, 09:33 AM   #2
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
Code:
find /path/to/dir -name "*.jpg" -or -type d -print|xargs chmod 777
reverse
Code:
find /path/to/dir -name "*.jpg" -print|xargs chmod 0644
find /path/to/dor -type d -print |xargs chmod 0755
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-15-2007, 10:20 AM   #3
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
Thanks,

Never seen it like this before. Can you explain how it's working?
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-15-2007, 10:45 AM   #4
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
Quote:
Originally Posted by Calvinguy View Post
Thanks,

Never seen it like this before. Can you explain how it's working?
I assume you've seen stuff like:
Code:
chmod -R 777 /path/to/dir
which for your 1st phase would work fine (except that it would chmod everything to 777 not just jpg's and directories).

To reverse it you can't run a recursive chmod because you need different
chmod for files and directories
Code:
find /path/to/dir -name "*.jpg" -print
finds all images in that directory and prints them
xargs executes "chmod 0644" for each image
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.