Retain - keep backup copies of a file
use Batch::Batchrun::Retain;
retain(FILE=>test,LIMIT=>5,DIR=>/apps/irmprod/archive,COMPRESS=>yes,DELETE=>NO);
The retain function provides a convenient way to keep backups of files. It keeps a determined number of files in numbered directories. Arguments are passed using named parameters. Each name is case insensitive. Of the several parameters only FILE and DIR are required.
retain
the name of the file to retain
the name of the main directory. This is the directory where the numbered subdirectories will be created.
EXAMPLE: archive/ bk1/ bk2/
compress the backup copies of the file. True values are indicated by passing 1 or yes. (unix only - defaults to no)
the numeric mode to use when creating the backup file (defaults to 0775)
deletes the original file if specified. True values are indicated by passing 1 or yes. (defaults to no)
number of backup copies to keep.
the prefix to use for each numbered directory. The numbered directory will automatically be created if it does not exist. (defaults to bk)
show each file as it is moved or copied. (defaults to off)
NOTE: retain returns 1 or 0 to determine completion status.
Current $VERSION is 1.03.
To install Batch::Batchrun, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Batch::Batchrun
CPAN shell
perl -MCPAN -e shell install Batch::Batchrun
For more information on module installation, please visit the detailed CPAN module installation guide.