I ran a perl script using
perl -p -i.bak -e "..." *.sh dir/*.sh
This created a copy of every file like
script.sh
script.sh.bak
I now want to restore from the .bak
files. How can I do this easily?
These backup files have names ending with the ". bak" file extension, and you use them to restore database backups through Microsoft SQL Server. by navigating to the backup utility and loading the BAK file as a restoration medium, you can open the file and restore the database.
In computing, ". bak" is a filename extension commonly used to signify a backup copy of a file. When a program is about to overwrite an existing file (for example, when the user saves the document they are working on), the program may first make a copy of the existing file, with . bak appended to the filename.
A file with . bak extension is usually a backup file that is used by different software tools to store backups of data. From database perspective, a BAK file is used by Microsoft SQL Server for storing the contents of a database.
for file in *.sh.bak dir/*.sh.bak; do cp "$file" "${file//.bak}"; done
Or you could use mv
instead of cp
.
find -name '*.bak'|sed 's:.bak$::'|xargs -n 1 -I % cp %.bak %
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With