deleting file and folders using Apple Script from user home directory

I have goggle on this subject. i have run several scripts also. but i am not able to delete either file or folders.

So, can any one tell me how to delete file and folders from user home directory ?




with search terms applescript delete files I find millions of results :wink:

in the Finder home represents the home folder of the current user

tell application "Finder" to delete file "myFile" of home
tell application "Finder" to delete folder "myFolder" of home

Thanks For your reply.
I just tried it and it worked.
I think i was making some mistakes in writing path for folders and file.
It is working fine now.
I just placed try statement before executing so if there does not exist any then it will not give me an error.


I need to run this application while my application install with package.
I want to add this script in package maker postupgrade scripts.
while giving this script in package maker , Application installation fails and gives me an error.

How can i run this script with package maker.