Project

General

Profile

Feature #743

Using Find and Rename to Make Backups of Files on FreeBSD

Added by Daniel Curtis almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Command-Line Help
Target version:
Start date:
02/07/2016
Due date:
% Done:

100%

Estimated time:
0.10 h
Spent time:

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' {} \;
    

Resources

#1

Updated by Daniel Curtis almost 9 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
#2

Updated by Daniel Curtis almost 9 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF