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


tar bzip | 9 comments | Create New Account
Click here to return to the 'tar bzip' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
tar bzip
Authored by: SOX on Oct 29, '03 01:14:27PM

I usually use tar -z or better yet tar -bzip to create zipped archives. Maybe some clever sole could write a clickable apple script that would take the highlighted folder in the finder and apply this action to it.

I'm not quite certian if this is HFS resource fork aware. on some minor tests it seemed that it was.



[ Reply to This | # ]
tar gzip apple script
Authored by: SOX on Oct 29, '03 01:41:40PM
here is a feeble but not quite working attempt at this

on run
	tell application "Finder"
		try
			activate
			set frontWin to folder of front window as string
			set frontWinPath to (get POSIX path of frontWin)
			tell application "Terminal"
				activate
				do script with command "(cd \"" & frontWinPath & "\" && tar -czf \"" & frontWinPath & ".tgz\"" & "\"" & frontWinPath & "\")"
			end tell
		on error error_message
			beep
			display dialog error_message buttons 
				{"OK"} default button 1
		end try
	end tell
end run
THIS DOES NOT WORK QUITE RIGHT. there are two problems. first frontWindowPath has a termnal "/" character which means I cant just concatenate ".tgz" to the end of it to create the archive name. some how I have to strip that tail "/" from the path name, but I dont know how to do this in applescript.

the second problem is that it's overkill to fire up a new terminal window to do its job: but that's only because I dont know how to just execute a unix command within apple script directly.

note that the "cd" command I execute is superfluous to the archive command. However it serves the purpose of testing to see if the directory you slected has an executable permission for you. the && comand guarentees that if the cd command fails the tar command is aborted.

if this worked correctly--and it does not-- it should allow you to select a folder in the finder and click the apple script to archive it.

[ Reply to This | # ]