Name | ren-backup |
Version | 1.6 |
Updated | 2004/03/16 21:25:21 |
RCS | ren-backup,v 1.6 2004/03/16 21:25:21 forman Exp forman |
Rating | |
Category | System administration, File manipulation |
Description |
This program adds a useful piece of metadata, the file backup date, as a suffix to the filename of a backed-up file. ren-backup creates a backup by copying or moving the original file to a filename with a standardized suffix. This is most useful as a method of preserving configuration files prior to modification and has been designed to improve upon filenames of the genre "filename-" and "filename--" by using a file suffixed with an RFC-822 compliant date string ("filename-YYYY-MM-DD"). |
Download | ren-backup |
forman:1> ls data-01.jpg data-02.jpg forman:2> ren-backup *jpg forman:3> ls data-01.jpg data-01.jpg-2003-12-25 data-02.jpg data-02.jpg-2003-12-25 |
REN-BACKUP(1) User Contributed Perl Documentation REN-BACKUP(1) NAME ren-backup - Create a backup file with a useful suffix SYNOPSIS ren-backup [ -htv ] [ -flm ] [ -D|-H ] [ --cp|--mv ] [ --hashlimit [limit] ] [file ...] DESCRIPTION This program adds a useful piece of metadata, the file backup date, as a suffix to the filename of a backed-up file. ren-backup creates a backup by copying or moving the orig inal file to a filename with a standardized suffix. This is most useful as a method of preserving configuration files prior to modification and has been designed to improve upon filenames of the genre "filename-" and "file name--" by using a file suffixed with an RFC-822 compliant date string ("filename-YYYY-MM-DD"). OPTIONS -h --help Prints this information. -t --test Prints what will happen without performing the operations. -v --version Prints version information. -c --cp --copy -m --mv --move The option "--copy" copies the file to the new backup filename. This is the default behavior. The option "--move" moves the file to the new backup file name. -D --date -H --hash The option "--date" uses an RFC-822 compliant date string (YYYY-MM-DD) as the suffix. This is the default. The option "--hash" uses a hash mark as the suffix. This overrides the default RFC-822 compliant date suffix. If the file already ends in a hash, and additional hash is added. The "--hash" option defeats the purpose of the program, which is to add metadata in the form of the backup date as a suffix, in order to help in restoring old configuration files. It's inlcuded to appease a unix guru friend of mine, who wouldn't use it until it embodied the power of his original backup alias (alias bu "cp \!$ \!$-") and until he chided me for duplicating a one-line alias with a 250-line perl script. ;^) -d --dot Prefix the backup filename, regardless of its suffix, with a dot to make it a hidden file. -f --force If the destination file already exists, overwrite it. -L --login Add the user login name to the end of the date suffix. This works only in conjunction with the "--date" flag and if the environment variable "USER" is set. -l --long Add time to the RFC-822 compliant date string (YYYY-MM-DD-HH:MM:SS). --hashlimit [limit] If the --hash flag is used, hash marks will be added to the end of a file until there are [limit] hashes. After the limit is reached, the program will complain. The default hash limit is "10". -r --restore Restore the specified backup file by removing the added backup suffix. If the original file still exists, the "--force" flag will be required to overwrite it. EXAMPLE For the following example, let the date be 1 January 1970. The command below will rename the file "/etc/hosts" to "/etc/hosts-1970-01-01". ren-backup /etc/hosts Let the time be 19:06:05. If we run the above command again, the filename "/etc/hosts-1970-01-01" already exists forcing the "--long" option and adding the time to the RFC-822 compliant date string. The resulting filename will be "/etc/hosts-1970-01-01-19:06:05". The next example moves a directory to a name prefixed with a dot and suffixed with an RFC-822 compliant date string. ren-backup --mv --dot dirname BUGS None. WARNING This program can delete or overwrite files. Use of this program is at your own risk. I take no responsibility for the loss of data. SEE ALSO ren-backup AUTHOR AND COPYRIGHT Michael Formanhttp://www.Michael-Forman.com Copyright (C) 2001, 2002 Michael Forman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Please see the Perl Artistic License. VERSION Current Revision: $Revision: 1.6 $ Last Modification: $Date: 2004/03/16 21:25:21 $ perl v5.8.1 2004-03-16 REN-BACKUP(1)
|
|