Feature #743
Using Find and Rename to Make Backups of Files on FreeBSD
Status:
Closed
Priority:
Normal
Assignee:
Category:
Command-Line Help
Target version:
Description
I recently needed to edit multiple files and wanted to have backups of the originals. To accomplish this task I found the rename tool that works great.
- Make sure the system is up to date:
sudo pkg update && sudo pkg upgrade
- Install rename:
pkg install rename
- Use rename and a regex substitution to add the .bak extension to the matched .db files:
find /path/to/search -type f -name "*.db" -exec rename -s 's/.db$/.db.bak/g' {} \;