ali-rantakari / trash

Small command-line program for OS X that moves files or folders to the trash.
574 stars 16 forks source link

trash -F deletes file immediately on network/shared drives #32

Open deus0ww opened 5 years ago

deus0ww commented 5 years ago

Command output: trash: some files were not moved to trash (authentication cancelled?)

Is this expected? If it is, I'll workaround it in some other way. If not, I would really appreciate it if you fix it. The current behavior is surprising and dangerous (I already lost a few files). I would expected the command to either fail silently or with the normal Finder warning dialog.

Note that without the '-F', the command fails as expected without deleting the file. Command output: trash: file_name: can not move to trash (-120: Directory not found)

jjarava commented 5 years ago

This also happens when using a "mounted" virtual volume (such as Google Drive mounted via MountainDuck). When deleting a file with plain trash, the operation fails, but with trash -F it works although you get an error message (and the "trash" sound plays):

$ ll Safari*pdf
-rw-r--r--  1 jjarava  staff   196K Feb  6  2018 Safari - 6 feb 2018 22:35.pdf
-rw-r--r--  1 jjarava  staff   196K Feb  6  2018 Safari - 6 feb 2018 22:35 copy.pdf
jjarava$
jjarava$
jjarava$ trash Safari\ -\ 6\ feb\ 2018\ 22\:35\ copy.pdf
trash: Safari - 6 feb 2018 22:35 copy.pdf: can not move to trash (-120: Directory not found)
jjarava$ ll Safari*pdf
-rw-r--r--  1 jjarava  staff   196K Feb  6  2018 Safari - 6 feb 2018 22:35.pdf
-rw-r--r--  1 jjarava  staff   196K Feb  6  2018 Safari - 6 feb 2018 22:35 copy.pdf
jjarava$ trash -F Safari\ -\ 6\ feb\ 2018\ 22\:35\ copy.pdf
trash: some files were not moved to trash (authentication cancelled?)
jjarava$
jjarava$ ll Safari*pdf
-rw-r--r--  1 jjarava  staff   196K Feb  6  2018 Safari - 6 feb 2018 22:35.pdf

When trying to delete the same file from the Finder directly, there's a message that allows to cancel the operation:

image