UNIQNAME Version 1.0 (09/12/89) Copyright (c) 1989 Ty Halderman Usage: UNIQNAME filename [filename...] -switch(es) Switches: -d:ymd -s -p:path -j -c -v -a:nnn -h -f:xxxxxxxx.xxx Use UNIQNAME -? for extensive help (redirection suggested) Extended help information: Extended help information: Renames one or more files to unique filenames. Up to 10 filenames may be provided, and any of them may be wildcards and may include full or relative paths. **Caution: using wildcards which also match the output filenames will cause recursive action, and the only way out is a Ctrl-C or Ctrl-break! Switches may be preceded with '-' or '/', may come anywhere in the command line, and are as follows: -d:format Supplies a date format to be used to form the unique filename. Uses the current system date. The format string is composed of the letters Y M and D in any order. They are used to create the filename by substituting the corresponding part of the date. For example, on Christmas of 1989: YMD creates 891225 MDY 122589 YM 8912 etc. The extension of the original file is preserved and duplications are resolved by putting the letters A-Z after the above date text, and when the 27th such file is encountered, going to AA through ZZ. Failure occurs when all 692 slots have been filled. Note that -d without any argument renames to just the sequence letters (i.e. A.DAT, B.DAT, etc.) -s Use sequence numbers 000 through 999 as the extension of the file, preserving the filename. When all 1000 slots have been filled, the program will fail. -p:path Use this option to provide a path for the destination file. Subdirectories will NOT be created if they do not exist. If the path points to another device, then the file will be copied and the original deleted instead of renaming. -j Use the 'Julian' date (misnomer, actually the day of the year) as the extension, 001 through 366 (sometimes). If there is already a file by this name, the program will fail. No other attempt at sequencing is done. -c Force copying rather than renaming. This ensures that the original file is undisturbed. This also means that twice the original space will be used on the disk. Note: The DOS copy command is used, which outputs its own 'n File(s) copied' messages. You may also have to hit ^C more than once to terminate if a copy is in progress. -v Verbose mode. The program typically is silent if no errors occur. This option causes the program to write informative messages as files are processed in all cases. -a:nnn Append mode. Normal sequencing restarts at 000 for each filename or wildcard given on the command line. With the -a option, the number is not reset between files, and will start at the provided number nnn if given. -a alone will still start at 000. -h Highest number mode. Like -a option, except that the highest existing file sequence +1 is used as the starting sequence number. Normally, if FRED.002 and FRED.003 already exist in the target directory, the next 3 numbers would be FRED.000, FRED.001 and FRED.004. Using the -h switch would make the next three .004, .005 and .006. Note: the 'highest' number is determined from the FIRST filename argument. -h implies -a, and ONLY works with the -s option above. -f:format Create filename from the given format. The letters Y, M, D, S, L, J, F, E and [] may be used to specify the following parts of the original and created filenames. The resulting filename and extension will be truncated to 8 and 3 characters respectively. Each letter may only be used once, though multiple [text] sets may be provided. Y = Year, 2 digits, leading 0 if needed. M = Month, 2 digits, leading 0 if needed. D = Day, 2 digits, leading 0 if needed. S = Sequence number, 3 digits 000 to 999, as explained above under -s option. L = Sequence letter(s): None, then A-Z and AA-ZZ J = Day of the year, 3 digits 001 to 366, as explained above under -j option. F = Filename of original file. If a wildcard is used, the name of each specific matching file will be included here. E = Extension of original file. Like F, a wildcard match will cause the extension of each specific matching file to be included here. [text] will be inserted (without []) as specified. Examples for Christmas, 1989 for file FRED.DAT, where the file is the 4th matching file (003 sequence): YMD.S --> 891225.003 YMD.E --> 891225.DAT FJ.E --> FRED359.DAT FS.E --> FRED003.DAT MDS --> 1225003 (no extension) F.S --> FRED.003 (same as -s alone) [xmas]Y[-Z].S --> XMAS89-Z.003 S --> 003 (no extension) F.E --> FRED.DAT which will fail for a second copy Other combinations, though probably not useful: ES.F --> DAT003.FRE SJL --> 003359C FEYMD.S --> FREDDAT8.003 (truncated filename) YMDSFE.F --> 89122500.FRE (loses sequence 3) SS.S --> 003 (S ignored after first time) .S is illegal (no filename) -? Outputs this help text. Documentation in separate form will be available with a future version. The sequencing process is restarted for each wildcard or filename provided. An example of different results for different ways of specifying the command line (assume -s for sequencing): Command line: UNIQNAME TH*.DAT -S THIS.DAT becomes THIS.000 {First one matching TH*.DAT} THAT.DAT becomes THAT.001 {Second one matching TH*.DAT} Command line: UNIQNAME THIS.DAT THAT.DAT -S THIS.DAT becomes THIS.000 {First one matching THIS.DAT} THAT.DAT becomes THAT.000 {First one matching THAT.DAT} However, if the -a option is used, the second example will be: Command line: UNIQNAME THIS.DAT THAT.DAT -S -A THIS.DAT becomes THIS.000 {First one matching THIS.DAT} THAT.DAT becomes THAT.001 {Sequence is appended} NOTE: Only one of the -s, -f, -j or -d will be used. They are evaluated with highest priority given to -j. Next are -d, -s and -f in that order. All output goes to standard output and may be redirected. It is suggested that since the only output other than with the verbose mode active are error messages, no redirection be done unless the resulting file is to be examined for errors later. Abort, Error and Warning messages: A001:- Illegal switch: -x A command line switch (-x) was not recognized W002:- 10 filenames already listed The maximum number of filenames or wildcards on the command line is 10. A003:- No files specified. There was no filename or wildcard provided on the comamnd line. A004:- No date, format or sequence switch. One of -j, -s, -d or -f must be used. A013:- Sequence switch -s not used but -h specified. -h only works when -s is used, providing the sequence as the extension of the file. W014:- More than one of -j, -s, -d and -f was used... Only one of these will function at a time. The second line of this warning message tells which was used. W005:- No files matching 'xxxxxxxx.xxx' A filename or wildcard was specified which matched no files. Processing will continue with the next argument, if any. E006:- File xxxxxxxx.xxx already exists. When -j is used, the output filename cannot already exist. E007:- Ran out of sequence numbers at 999. Three digits are provided for the sequence number, and all 1000 such names have been used. E008:- Ran out of sequence letters at ZZ. Two characters are provided for the sequence letters, and all 692 such names have been used. E009:- Copy of xxxxxxxx.xxx to xxxxxxxx.xxx failed. UNIQNAME could not copy the source file to the destination. E010:- Rename of xxxxxxxx.xxx to xxxxxxxx.xxx failed, code nn In an attempt to rename the file, DOS could not perform the rename. Be sure your target directory (if specified with -p) exists. E011:- [Copy/Rename] of xxxxxxxx.xxx to xxxxxxxx.xxx failed. This is like E009 or E010, but is used if the target is on another drive. W012:- Delete of xxxxxxxx.xxx failed, code nn When renaming to another drive, the file is actually copied and then deleted from the source directory. This message indicates that the source file could not be deleted. When a message contains a 'code nn' phrase, that code is the DOS error code, such as 5=path not found, etc. Actions: Abort messages: The program ends immediately. Error messages: Processing of the current filename or wildcard is terminated. Further processing will still continue. Warning messages: Informational only; the program probably has not acted as you intended it to, but there should be no loss of data or files. This program is Copyright (c) 1989 by Ty Halderman, all rights reserved. There is not now nor shall there be ANY charge for use of the program in any environment. Suggestions are welcome to Compuserve ID [70155,1125] or by mail to 3227 Castlewood, Houston TX 77025.