Version
This document is current with BakFile version 1.0.6.1. The most up to date information on BakFile
can be found at BakFile Product Page.
RSS Feed
You can monitor the changes to this utility by subscribing to the BakFile RSS Feed.
You can either click on the link to start your RSS client or enter the feed address (http://www.iii-software.com/products/bakfile/rss.xml) directly into your client.
This is a low-volume feed which will contain only items of interest to BakFile users.
Overview
BakFile is a utility to create backup copies of a file.
It is particularly useful in scripts as it operates from the command line.
BakFile will take an original file and move (or copy) it to a subdirectory named 'backup'. The name of the file in the backup directory will contain a date and time stamp to make it unique. If the file has no extension, the date and time will be appended to the filename. For example, if the input file is "in.txt", the output file will be named "in.20100914.13010203.txt". The date is in year month day (yyyymmdd) format. The time is in hour, minute, second, decimal format (hhmmssdd). Many of the behaviors can be changed using the command line options.
The Problem
It is common to write a script to perform a redundant task, such as processing input files on a server.
It is also common to archive copies of the files that were processed.
BakFile provides a convenient method of creating a backup of files that were processed.
It is particularly useful in a server environment where most jobs are run on a scheduler and need a command line interface.
Requirements
BakFile will run on any 32-bit or 64-bit version of Windows. Windows 95 through Windows 7 are supported on workstations. On the server side, all versions of Windows Server from NT4 through 2008R2 are supported.
Installation
Download the BakFile package.
BakFile does not require a formal installation. You can unpack the zip into any directory. You can either reference the utility with a fully qualified path (e.g., \util\bakfile) or you can add the director containing BakFile to your path.
If you need a utility to unpack the zip file, we suggest WinZIP.
Syntax
BakFile infile [-options]
Parameters
Parameter | Description |
---|---|
infile | Input (original) file to back up. This file must already exist or the program will issue an error message. The input file must be the first parameter specified on the command line after the program name. |
-copy | When specified, the file will be copied instead of moved. The original file will be retained after the backup copy has been made. Without this switch, the original file will be removed. |
-dir=(directory) | Determine the subdirectory where the backup will be made. The default is a backup. This is typically a relative path, (relative to the original file), although an absolute path (fully qualified) is permitted. |
-post | When specified, the unique portion of the filename will be appended to the filename. |
-pre | When specified, the unique portion of the filename will be before the file extension. If no file extension, the unique string will be appended to the filename (similar to -post). |
-sep=(char) | Determine the separator to use. The (char) may be either the period, hyphen or underscore. The default is a period. |
-unique=(parm) | Determine what to use for the unique portion of the filename. (parm) may be either date (yyyymmdd), time(hhmmssdd) or datetime (both date and time separated by the separator character. |
Errors
Any error generated by the utility can be checked through the ErrorLevel (dos, cmd, script).
Error # | Text |
---|---|
0 | No Error |
2 | Input file does not exist |
5 | Invalid Command Format: You must specify file to backup on command line |
7 | Invalid command line option |
8 | Invalid choice for the unique option |
9 | Invalid choice for the separator option |
Revision History
Date | Version | Change Description |
---|---|---|
2011.05.22 | 1.6.0.1 |
|
2011.05.18 | 1.0.1.5 | Add the following switches: copy. |
2010.09.19 | 1.0.1.4 | Add the following switches: pre, post, sep and unique. |
2010.09.18 | 1.0.1.3 | Date and time stamp are put before the extension. This was done to preserve the file's type in Windows. |
1.0.1.2 | Correct error message text | |
2010.09.14 | 1.0.1.1 | Initial release. |
2003.06.02 | 1.0.0.0 | Based on a prior work: bakfile(mf). |