using tgz

hi,
i’m trying to use gnutar, (compress and compare) but the results i get are too strange to be true. :slight_smile:

set mydestination to (path to desktop)
set myfolder to folder "foo" of mydestination
do shell script "gnutar -pczf " & (quoted form of POSIX path of mydestination & space & quoted form of POSIX path of (myfolder as text) as text)

whats wrong with my syntax ? maybe the right succession of commands? :rolleyes:

-f, --file F
-j, --bzip2
-p, --preserve-permissions
-v, --verbose
-z, --gzip

The “folder foo of mydestination” stuff should be in a “tell application “Finder””

set mydestination to (path to desktop)
tell application "Finder"
	set myfolder to folder "foo" of mydestination
	do shell script "gnutar -pczf " & (quoted form of POSIX path of mydestination & space & quoted form of POSIX path of (myfolder as text) as text)
end tell

But the resulting shell command is

“gnutar -pczf ‘/Users/js/Desktop/’ ‘/Users/js/Desktop/foo/’”

Is this actually, what you want?

hallo Juergen

great, you’re helping out people still at your first posts. Not like me :smiley:
Welcome on Macscripter!
i cannot understand what i’m doing wrong in my script. After some experiments, no further developments.

set posixpt to POSIX path of (path to desktop) & "Test:"
set cmd to ("gnutar -czvf " & quoted form of (posixpt as text) & space & quoted form of posixpt & "Katalog.pdf.tgz:" as text)

do shell script cmd

You’re not adding your strings correctly. In other words you are trying to add 2 strings to create the proper path. Therefore each of the 2 items must be a string so you can add them together. “path to desktop” is not a string so you must coerce it to one. Try this…

set theDesktop to (path to desktop) as text
set inputFolder to theDesktop & "Test:"
set outputFile to theDesktop & "Test.tgz"

set cmd to "gnutar -pczf " & quoted form of POSIX path of outputFile & space & quoted form of POSIX path of inputFolder

do shell script cmd

Hank,
thanks for clearing up my mistakes, now everything runs fine. In future i’ll consider more string coercions.

to return to gnutar:
i thought, tzg packets would save a lot of Megabytes. I used days ago ‘Dropstuff’ from Aladdin software, and their tzg package is very lightweight, compared to the common zip-variant of the ‘Finder’. So i thought to write a nice applescript using the tgz-method but without calling some apps. I don’t like if a script runs different apps, if i can get same or better results with shell. Hm. I’m confused about the unix-books. Not so simple to read unix- cryptography for amateurs…


maybe we could launch a new feature for Macscripter: a thanks-button.