James Greene
Fachbüro
für EDV Beratung, Systeme und Dienstleistungen
NAMEDATE: Add the date to a given filename
Version 6.00
Copyright (c) 1999, 2002, 2003, 2004, 2005, 2006, 2007
CONTENTS
- What is NAMEDATE
- Installing NAMEDATE
- Using NAMEDATE
- Examples
- Known Issues and Limitations
- Support
- Source Code availability
What is NAMEDATE?
NAMEDATE is a command line utility for Windows 9x/Me/NT/2000/XP.
NAMEDATE will change the name of a given file to include the date. For
example, a file name somefile.ext will be renamed to somefile 02-Jul-2003.ext
when NAMEDATE somefile.ext is run.
Installing NAMEDATE
NAMEDATE is a single Win32 character-mode executable. It does not require
any additional .DLLs or other files, but will only run in a Windows "DOS-Box" (Command Prompt).
To install NAMEDATE:
- Download the NAMEDATE.ZIP file from
- Use PKUNZIP, WinZIP or some other ZIP utility to extract the contents
of the ZIP file.
It is recommended to put the NAMEDATE.exe file in a directory that is
contained in the PATH, e.g. C:\Windows\Command on Windows 9x/Me, or
C:\WinNT\System32 (or C:\Windows\System32) on Windows NT/2000/XP.
Using NAMEDATE
Usage: NAMEDATE [switches] filename.ext
where switches may be
| /F | put the date before the original filename | |
| /X | put the date as an extension to the original filename | |
| /Z:"format" | specify the date/time format (see below) | |
| /ZZ:"format" | specify the format of the whole name (see below) | new in v5.0 |
| /E:"language" | specify the language for /Z conversions (ANSI format) (see below) | new in v6.0 |
| /EE:"language" | specify the language for /Z conversions (ASCII format) (see below) | new in v6.0 |
| /8 | renames the file to a DOS-compatible 8.3 filename (xxyymmdd.ext) | |
| /M | use the file's modification date/time instead of the current time | |
/O+d /O-d | add or subtract d days to/from the date | |
/A+m /A-m | add or subtract m minutes to/from the time | |
| /U | convert any spaces in the filename to underscores | |
| /D | rename directories as well as files (don't use together with /C) | |
| /H | rename SYSTEM and HIDDEN files | |
| /C | copy files instead of renaming them | |
| /L | file extension begins with the LAST period in the name | new in v5.2 |
| /K | force operations (kill any existing target files) | |
| /S:"path" | move or copy the file into the directory path | |
| /B:num | specify how many files can be renamed in a single directory | new in v5.0 |
| /Q | quiet operation - no information message will be displayed | |
| /Y | answer 'yes' to all confirmation questions | new in v5.0 |
| Legacy Switches |
| /N | uses the numeric date form (02-07-2003) | same as /Z:"d-m-Y" |
| /R | uses the reverse numeric date form (2003-07-02) | same as /Z:"Y-m-d" |
| /T | adds the time the date (2003-07-02-17-27) | same as adding "-H-M" to the /Z format string |
and where filename.ext
is the name of an existing file. The filename.ext may contain a drive letter, a directory name and wildcards, so it's possible to rename all of the files in a given directory.
"format" characters used by the /Z option
| a | Abbreviated weekday name |
| A | Full weekday name |
| b | Abbreviated month name |
| B | Full month name |
| d | Day of month as decimal number (01-31) |
| H | Hour in 24-hour format (00-23) |
| I | Hour in 12-hour format (01-12) |
| j | Day of year as decimal number (001-366) |
| m | Month as decimal number (01-12) |
| M | Minute as decimal number (00-59) |
| p | Current locale’s A.M./P.M. indicator for 12-hour clock |
| S | Second as decimal number (00-59) |
| U | Week of year as decimal number, with Sunday as first day of week (00-53) |
| w | Weekday as decimal number (0-6; Sunday is 0) |
| W | Week of year as decimal number, with Monday as first day of week (00-53) |
| y | Year without century, as decimal number (00-99) |
| Y | Year with century, as decimal number |
| z | Time-zone name or abbreviation; no characters if time zone is unknown |
| Z | Same as z |
| \ | Accept the following character as text instead of a formatting command |
| Additional Options when /ZZ is used: |
| F | The original filename (without the extension) |
| X | The original file extension (without the leading dot) |
| C | A 4-digit counter |
| c | A 2-digit counter |
"language" options used by the /E and /EE options
/E specifies the language to use when using /Z or /ZZ with the a, A, b, and B keys.
/E specifies that the conversion will use ANSI characters (Windows character set),
while /EE specifies that the conversion should use ASCII (DOS) characters. See the
examples below for more clarity. For a complete list of languages, please see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_language_strings.asp
Version Information
New in version 6.00 (8. Sept 2007):
- Added the locale options /E and /EE, enabling different languages.
New in version 5.21 (26. May 2007):
- Fixed an error that prevented /Y from working properly in v5.2.
New in version 5.2 (24. May 2007):
- Added the new /L option so that NAMEDATE will assume that the extension begins with the LAST period in a filename.
- Several internal code changes were required to support this new option.
New in version 5.1 (24. Nov. 2006):
- When using the /S option when the source file was also in a sub-folder, NAMEDATE assumed that the target was a sub-directory of the source folder. This has been fixed.
- New! When using the /S option, and the target directory doesn't exist, NAMEDATE will now attempt to create it.
New in version 5.04 (23. Nov. 2005):
- Fixed a "file not found" error when the filename included a subdirectory and wildcards.
- Fixed a crash when using the /F option.
New in version 5.03 (8. Feb. 2005):
- The /U parameter should now work correctly when used with the /Z option.
New in version 5.01:
- Fixed a bug that prevented the /Z:"format" option from working correctly.
New in version 5.0:
- Added the /ZZ:"format" option to allow full control of the filename.
- Changed the behaviour of NameDate to prompt before a file is copied, deleted or renamed. To automatically reply "yes" to these prompts (if you are using NameDate in a batch file), be sure to add the /Y option to the NameDate command line.
- Added the /B:num option to allow larger directory listings. For example, /B:5000 tells NameDate to reserve a buffer for up to 5,000 filenames per directory.
New in version 4.1:
- Added the /S:"path" option to move or copy the renamed file into a new directory.
- Added the /8 option that renames the file to an 8.3-compatible filename.
New in version 4.01:
- Corrected a bug in the /O option that was introduced in version 4.0.
New in version 4.0:
- Added the /Z:"format" option to allow more flexibility how the date and time are represented.
- /N, /R and /T are now internally converted to /Z:"..." formats.
- Added the /Anum option to add or subtract num minutes from the time.
- Added the /K option that will delete the target file if it already exists.
- Added the /Q option to reduce the amount of "noise" that NAMEDATE produces when called from a batch file.
New in version 3.2:
- Added the /C flag, to make a COPY of the file instead of simply renaming it.
- Added version information to the NameDate executable.
- The source code now includes a MAKE file.
New in version 3.1:
-
Added the /M flag, to use the file's own date/time instead of the current time.
-
Added the /Onum option to add or subtract num days from the date.
For example, if today is the 15th of May, 2003, using /O5 will add 20-May-2003 to the filename.
On the other hand, using /O-5 will add 10-May-2003 to the filename.
Please note that the /M and /Onum options may be used together.
- Discontinued the flag /W flag since it wasn't needed anymore.
New in version 3.0:
-
The filename.ext can now include path information. For example,
C:\> NAMEDATE d:\backup\*.zip
will now correctly rename all .ZIP files in the folder D:\BACKUP.
- Changed the behaviour of the /W flag.
Now, NAMEDATE assumes that a wildcard is used, unless /W is specified. If you don't use wildcards,
NAMEDATE will still work without the /W
flag.
- Added the /D flag, so that you can
choose if you want subdirectories to be renamed or not. Please note
that NAMEDATE does not recurse down into the directories, it will just
rename any directory names that it finds in the folder that match the
wildcard you specified. This flag is only recognised when wildcards
are turned on (in other words, when /W is
NOT specified.)
- Added the /H flag, so that you can
choose if you want hidden or system files also to be included in the
renaming function. This flag is only recognised when wildcards
are turned on (/W is
NOT specified.)
- The . and .. directories are now automatically skipped, so that
there are no more error messages when using the *.* wildcard.
Examples
In all of the examples below, the current date is 1. July 2003 at 5:56pm. The file "sample.txt" has a timestamp of 30. June 2003 at 10:23am.
- NAMEDATE "sample.txt"
Renames "sample.txt" to "sample 01-Jul-2003.txt"
- NAMEDATE /F "sample.txt"
Renames "sample.txt" to "01-Jul-2003 sample.txt". This option is best used together with the /R or /Z:"Y-m-d" commands to make sorting the directory listing easier.
- NAMEDATE /X "sample.txt"
Renames "sample.txt" to "sample.01-Jul-2003.txt".
- NAMEDATE /XZ:"Ymd" "sample.txt"
Demonstrates the use of the new /Z; command. Renames "sample.txt" to "sample.20030701.txt".
- NAMEDATE /Z:"Y-m-d H-M-S" "sample.txt"
Another example of the /Z: command. Renames "sample.txt" to "sample 2003-07-01 17-56-39.txt".
- NAMEDATE /Z:"Y-m-d \at I.M.S p" "sample.txt"
Yet another example of the /Z: command. Renames "sample.txt" to "sample 2003-07-01 at 05.56.39 PM.txt". Note that the 'a' in ' \at ' is preceeded with a backslash to prevent it from being interpreted as "abbreviated day of the week".
- NAMEDATE /MZ:"cre\ate\d Y-m-d \at I.M.S p" "sample.txt"
A complex example of the /Z: command, combined with the /M option. Renames "sample.txt" to "sample created 2003-06-30 at 10-23-44 AM.txt". The 'a' and 'd' commands have to be escaped with backslashes, and the /M command tells NAMEDATE to use the file's date instead of the current date.
- NAMEDATE /O+3 /MZ:"Y-m-d" "sample.txt"
Demonstrates the /O command that adds or subtracts a given number of days from the date. In this case, it starts with the file's date, since the /M command was specified. Renames "sample.txt" to "sample 2003-07-03.txt".
- NAMEDATE /A-90 /MZ:"Y-m-d-H-M" "sample.txt"
Demonstrates the /A command that adds or subtracts a given number of minutes from the time, again starting with the file's modification time since /M was specified. Renames "sample.txt" to "sample 2003-07-03-8-53.txt"
- NAMEDATE /U "sample.txt"
Demonstrates the /U command that converts any spaces in the filename to underscores. Renames "sample.txt" to "sample_01-Jul-2003.txt"
- NAMEDATE /C "sample.txt"
Demonstrates the /C command that copies the file instead of renmaing it. This example copies "sample.txt" to "sample 01-Jul-2003.txt"
- NAMEDATE /8 "sample.txt"
Demonstrates the new /8 command that renames the file using the DOS-compatible 8.3 limitations. This example renames "sample.txt" to "AA030701.txt"
- NAMEDATE /S:"C:\Backup" "sample.txt"
Demonstrates the new /S: command that puts the renamed (or copied, when used together with the /C command) file in a different folder. This example renames "sample.txt" to "C:\Backup\sample 01-Jul-2003.txt"
Known Issues and Limitations
- If the target file (e.g. 'somefile 25-Dec-2001.ext' already exists, the rename/copy function will fail with the error 'File exists' unless you use the /K option.
- NAMEDATE may fail to move the file when moving to a different drive. If you want to rename from one drive to another, use the /S and /C commands together to create a copy.
Support
NAMEDATE Version 6.00 (08. September 2007)
Copyright (c) 1999, 2002, 2003, 2004, 2005, 2006, 2007 by James Greene. All rights reserved.
NAMEDATE comes with NO WARRANTY to the extent permitted by law.
You may redistribute copies of NAMEDATE under the terms of the
GNU General Public License. For more information about these
matters, see the file named COPYING.txt, or contact the author at the address below.
Please report any bugs to .
Source Code availability
The C source code for NAMEDATE is included in the
download archive. NAMEDATE was developed in ANSI C, and compiled with Microsoft
Visual Studio .NET.
Back to the Shareware Overview
This page was last updated on
Saturday, 08. September 2007.
Copyright ©
James Greene.
All rights reserved.
Information in this document is subject to change without notice.
Please send any questions or comments about this page to .
Any product names or trademarks mentioned are
property of their respective owners. All rights respected.