How can I delete a folder/file with a shell command, that it appears in the Trash?

It works, but I want to delete a file/folder with a shell command, that the deleted item is shown in the Trash in the dock.

iBackup, it sounds like maybe you’re set on using the command line… but if you don’t mind using a tell statement, you can do this:

This moves the file to the trash, just as if you selected it and hit Cmd-delete in the Finder. You could even use a POSIX file path if that integrates better with whatever you’re doing on the command line: