Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript to modify user permissions' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to modify user permissions
Authored by: qwerty denzel on Mar 16, '05 10:15:19PM
Sorry, I cut myself off there. On my computer I am of course an administrator, this script is probably not useful to those who have a standard user account, since they can only change the permissions of their own files. Here is another script that changes the permissions of all items in your users folder.

property excluded_items : {"Public", "Sites"}

tell application "System Events"
	set currentUser to quoted form of (name of current user as string)
end tell

set this_folder to (path to home folder) as string
tell application "Finder"
	set these_files to every item of folder this_folder
end tell
repeat with i from 1 to the count of these_files
	set this_file to (item i of these_files as alias)
	set this_info to info for this_file
	set this_name to name of this_info
	if this_name is not in excluded_items and alias of this_info is false then
		set this_POSIX to quoted form of POSIX path of this_file
		try
			do shell script "sudo chown -R  " & currentUser & ":" & currentUser & " " & this_POSIX
		end try
		try
			do shell script "sudo chmod -R 775 " & this_POSIX
		end try
	end if
end repeat
Note the first 'do shell script' has:
"sudo chown -R  " & currentUser & ":" & currentUser & " " & this_POSIX
instead of:
"sudo chown -R  " & currentUser & ":admin " & this_POSIX
which is used in the original hint.

[ Reply to This | # ]