I am working on linux scripts , Assume that the directory is consisting of these following scripts .
ls *.sh
test.sh
MyScripts.sh
My question is , before making any modifications to test.sh script , i want to keep a backup copy of it , so that if anything messes up , i will be not screwed up . please tell me how can i keep a copy of test.sh in the same directory ?? before making any modifications to the actual file test.sh .
Thank you very much .
How to: Create a Copy of a File in a Different Directory in Visual Basic. The My.Computer.FileSystem.CopyFile method allows you to copy files. Its parameters provide the ability to overwrite existing files, rename the file, show the progress of the operation, and allow the user to cancel the operation.
The following code examples demonstrate how to use CopyFile. ' Copy the file to a new location without overwriting existing file. My.Computer.FileSystem.CopyFile ( "C:\UserFiles\TestFiles estFile.txt", "C:\UserFiles\TestFiles2 estFile.txt") ' Copy the file to a new folder, overwriting existing file.
To copy a text file to another folder. Use the CopyFile method to copy a file, specifying a source file and the target directory. The overwrite parameter allows you to specify whether or not to overwrite existing files. The following code examples demonstrate how to use CopyFile. ' Copy the file to a new location without overwriting existing file.
Use the CopyFile method to copy a file, specifying a source file and the target directory. The overwrite parameter allows you to specify whether or not to overwrite existing files. The following code examples demonstrate how to use CopyFile. VB. ' Copy the file to a new location without overwriting existing file.
Consider using revision control, such as git or Subversion.
You can make a copy before your work too:
cp test.sh test.sh.orig
The usual approach is to
cp test.sh test.sh~
(or test.sh.bck
or whatever naming convention). In fact, any decent editor should have an option to do this automatically for you. Vim does it by default (saves a backup name filename~ on modification)
Good 'starter' options include:
I personally vouch for git
.
I took care to name (D)VCS methods that have ample interoperability options so as to prevent data lockin.
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