Sunday, November 16, 2003

RenByDate v2003.11a (a.k.a. QRen)

Finished up the first (re-)release of RenByDate which is a tool that will rename a file and allow you to insert things like the current year, or the day of the week into the filename. This is actually a re-write of QREN that I wrote back in 1991-1992 and uploaded to the CompuServe forums under the userID of 71750,3724 (and was also part of a larger package called QUTIL1). Back then, I charged $5/seat or $20/server for the package but now I'm re-releasing it under the BSD open-source license.

The old version of QREN was written for the MS-DOS platform (using the MIX C compiler) and used some MIX C specific call as well as not being able to handle longer filenames. During the re-write, I used MinGW and tried to re-structure the code to make for easy porting to other platforms.

Installation is as easy as copying the "renbydate.exe" file to a directory in your Windows PATH. None of the other files are required.

Using RenByDate is pretty simple: renbydate log.txt log_%Y%m%d_%H%M.txt will rename "log.txt" to "log_19921021_1455.txt" (if the date/time is currently Oct-21-1992 at 2:55pm). Or you can specify that it should use the timestamp of the file by putting the "-f" switch in. If you're using it inside of a batch file, you'll probably need to double-up the '%' signs (e.g. %%Y%%m%%d) because MS-DOS/Windows likes to interpret '%' signs differently then when you're using the command at the command prompt. As with the original version, it only handles single filenames and will choke on wildcards.

Download:
renbydate-2003.11a.zip - 10KB, Win32 (README.TXT and LICENSE.TXT)
renbydate-2003.11a-source.zip

renbydate 2003.11a - Rename files based on the current or file timestamp value.
Copyright 1991-1992,2003, Thomas G. Harold, All Rights Reserved.
For updates visit http://www.tgharold.com/ or e-mail tgh@tgharold.com.

Usage: renbydate [-f] filename newname
-f - Rename using filename time stamp
filename - This is the original filename, wildcards are not allowed.
newname - This is the new filename, with optional time/date codes

The following is a list of codes to use in the string. (case sensitive)
%a - Abbr. weekday name %A - Full weekday name
%b - Abbr. month name %B - Full month name
%d - Day of month (01..31)
%H - hour (00..23) %I - hour (01..12)
%j - day of year (001..366) %m - month (01..12)
%M - minute (00..59) %p - AM/PM indicator
%S - second (00.59) %U - week of year (Sun first, 00..52)
%w - day of week (0..7) %W - week of year (Mon first, 00..52)
%y - year (00..99) %Y - year (0000..9999)
%Z - timezone name %% - '%' (percent) sign

Note: In a windows batch file, you must double up '%' signs.


For the historically curious folks, they may wish to download the original QRen v1.0 zip file from 1992. Or you can see the contents of the old QRen Documentation, Site License, or Product List files.

Source files:

dbg.c
dbg.h
file.c
file.h
jdate.c
jdate.h
LICENSE.TXT
makefile
renbydate.c
usage.c
usage.h

No comments: