December 30, 2008 Archives

2008-12-30 01:33:19

[HowTo] Delete vim's backup files

In general, vim's auto backup function (:set backup) is a rather useful feature that saved me, or more precisely, some of my files several times. Nevertheless, all these files with an appended tilde, flooding your filesystem, are quite annoying. So, here's a way to get rid of all these files in one go:

#find all backup files in your home directory
find ~ -name "*~"
#find and delete all backup files in your home directory find ~ -name "*~" -delete
#find all backup files and delete them only if the original files exist! find ~ -name "*~" -exec bash -c '[ -e "${1%?}" ] && rm -f -- "$1";' _ {} \;

Posted by haui | Permanent Link | Categories: linux