GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Help with chmod (https://gfy.com/showthread.php?t=696073)

Calvinguy 01-15-2007 09:28 AM

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.

darksoul 01-15-2007 09:33 AM

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


Calvinguy 01-15-2007 10:20 AM

Thanks,

Never seen it like this before. Can you explain how it's working?

darksoul 01-15-2007 10:45 AM

Quote:

Originally Posted by Calvinguy (Post 11734175)
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


All times are GMT -7. The time now is 03:23 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123