Filed under: Features, How-tos, AppleScript
If you work with file permissions a lot, then you know how crazy it can get when you need to change a ton of files to their correct permission types. With this AppleScript folder action, you can easily change the permissions just by dragging and dropping files in their correct folder.
Creating the Script
To get started, we'll open the Script Editor (located in /Applications/Utilities). Once you have the editor opened, copy/paste the following script:
on adding folder items to this_folder after receiving added_items
tell application "Finder"
set fold_name to the name of this_folder
try
repeat with i from 1 to number of items in added_items
set new_item to item i of added_items
set the item_path to the quoted form of the POSIX path of new_item
do shell script ("/bin/chmod -R +r " & item_path)
end repeat
end try
end tell
end adding folder items to
This script will change the dropped files to a permission of "0644" meaning that everyone can read the file. For information about chmod and command line permissions strings, visit the Wikipedia page. Continue reading to learn more about this AppleScript and folder actions.
Continue reading AppleScript: Exploring the power of Folder Actions, part III
TUAWAppleScript: Exploring the power of Folder Actions, part III originally appeared on The Unofficial Apple Weblog (TUAW) on Thu, 26 Mar 2009 08:00:00 EST. Please see our terms for use of feeds.
25 Useful Free Mac Apps for Freelancers
As a full-time freelancer and part-time geek, I like to play around and install applications on my Mac. In the following list I share some of the free Mac apps that make my life easier. I also own a PC, so I give my readers who use a PC an alternative for each app.
AppleScript: Exploring the power of Folder Actions, part III
Filed under: Features, How-tos, AppleScript
If you work with file permissions a lot, then you know how crazy it can get when you need to change a ton of files to their correct permission types. With this AppleScript folder action, you can easily change the permissions just by dragging and dropping files in their correct folder.
Creating the Script
To get started, we'll open the Script Editor (located in /Applications/Utilities). Once you have the editor opened, copy/paste the following script:
on adding folder items to this_folder after receiving added_items
tell application "Finder"
set fold_name to the name of this_folder
try
repeat with i from 1 to number of items in added_items
set new_item to item i of added_items
set the item_path to the quoted form of the POSIX path of new_item
do shell script ("/bin/chmod -R +r " & item_path)
end repeat
end try
end tell
end adding folder items to
This script will change the dropped files to a permission of "0644" meaning that everyone can read the file. For information about chmod and command line permissions strings, visit the Wikipedia page. Continue reading to learn more about this AppleScript and folder actions.
Continue reading AppleScript: Exploring the power of Folder Actions, part III
TUAWAppleScript: Exploring the power of Folder Actions, part III originally appeared on The Unofficial Apple Weblog (TUAW) on Thu, 26 Mar 2009 08:00:00 EST. Please see our terms for use of feeds.
25 Useful Free Mac Apps for Freelancers
As a full-time freelancer and part-time geek, I like to play around and install applications on my Mac. In the following list I share some of the free Mac apps that make my life easier. I also own a PC, so I give my readers who use a PC an alternative for each app.
No comments:
Post a Comment