since I will always have multiple Screenshot saved in Desktop. The usual way I deal with them is:
- in terminal :
trash file
It is a command I found here: https://formulae.brew.sh/formula/trash
while it is slow to move them to trash one by one
Then, I found another way to delete file starting with same name all at once: find ~/Desktop -type f -name "Screenshot*" -delete
while it is not safe, since it will nuke all files
I tried to combined them as find ~/Desktop -type f -name "Screenshot*" -trash
, but failed.
Error msg is: find: -trash: unknown primary or operator
Anyone knows how to safely move files starting with the same name to trash all at once in terminal? Thanks.
CodePudding user response:
It looks like a simple regular expression will solve your problem:
$ ls
Screenshot 2022-07-06 at 12.12.23.png test2
Screenshot-test test1 test3 test4
$ trash ~/Desktop/Screenshot*
$ ls
test1 test2 test3 test4