Help with zip

property deleteOriginal : false

on open theseFolders
	repeat with oneFolder in theseFolders
--commented  the line below so that script can work both on files and folders
		--if (folder of (info for oneFolder)) then
			tell (POSIX path of oneFolder) to set {source, destination} to {it, it's text 1 thru -2 & ".zip"}
			do shell script ("/usr/bin/ditto -c -k -rsrc --keepParent " & quoted form of source & " " & quoted form of destination)
			if deleteOriginal then do shell script "rm -r " & quoted form of source
		--end if
	end repeat
end open

I got this script from:
http://macscripter.net/viewtopic.php?pid=84453

The problem:
i compressed a file in my “Desktop” folder named “New TextEdit Document.txt
An archive with the name "New TextEdit Document.tx.zip" is created.

When I extracted it, I got a folder named “Desktop” and “New TextEdit Document.txt” inside it which does not make sense to me. (Probably, it was done to suit the needs of the user in that thread)
It should have been simply “New TextEdit Document.txt” (without the Desktop folder) and the archive name should have only been “New TextEdit Document.zip”.

Can someone fix it in such a way that folder hierarchies are maintained but not unnecessarily like in the above case (i.e. the Desktop folder) and secondly the names?

Thanks in advance.

It seems that the culprit is the ‘string’
–keepParent

If I understand well it asks the tool to compress the file with its container.

remove it and you will be free of the unwanted ‘desktop’ folder.

Yvan KOENIG (from FRANCE lundi 27 avril 2009 22:25:54)

Thanks, Yvan. You are right.
Other problem: I tried to extract this file in Windows. I did not see the “_MacOS” folder which is created when a folder is control-clicked and the default “Compress” is used in Mac OS 10.5. This is good because i did not want that folder.

However, a hidden file with the name “._Picture” is also created (if the file i compress is named as “Picture”).
Is there a fix for it?