I want to automatically delete the backup files(those ending with ~) from everywhere on my computer.

I tried to write a simple script usinglocate command, but I'm stuck at deleting file having space in there name, like this

/home/abc/def/Unnamed Document~

Can you provide a script to delete backup files(considering that some of them have space in there name).


Use find instead:

find /some/path -name '*~' -type f -delete
  • -name '*~' for filenames ending in ~
  • -type f for regular files (skipping directories, etc.)
  • -delete ... well?

Not the answer you're looking for? Browse other questions tagged or ask your own question.