NameDate

Submit command line tools that you find here.
Post Reply
Message
Author
billon
Posts: 843
Joined: Sat Jun 23, 2012 4:28 pm

NameDate

#1 Post by billon »

https://informatics-consulting.ch/softw ... m#Overview
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 31-Oct-2016.ext when namedate somefile.ext is run.

NameDate offers a whole range of options to configure how the resulting file name should be formatted, define where the file should be located (you can move the files while renaming them), add a counter or several other features.

NameDate is free software and comes with full source code.
Image

User avatar
webfork
Posts: 10818
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Re: NameDate

#2 Post by webfork »

So this may show some of my inexperience on the command-line, but I feel like this tool is in serious need of some example codes and outputs. I couldn't figure out how to do a rename that just lists filename-Month-Day-Year.ext Does anyone have any idea?

---

Meantime, here's another one I came up with from AntRenamer on the dates front:

Setup some kind of rename with a date change saved

1. Open program, add a file to rename, and choose Actions - Use Date & Time
2. Modify the mask as needed
3. Press the Add Selected Action button
4. Press Save

Image

When prompted, you can save as "add dates.arb" to work with the batch file process below to rename files in an "input" directory in the same folder:

"C:\Temp\PortableApps\AntRenamerPortable\AntRenamerPortable.exe" -b "add dates.arb" -af ".\input\*.*" -g -x

To be clear, the program billon mentioned is clearly faster and more flexible, I'm just having trouble with it.

User avatar
lintalist
Posts: 434
Joined: Sat Apr 19, 2014 12:52 am
Contact:

Re: NameDate

#3 Post by lintalist »

webfork wrote: Fri Jul 17, 2020 8:17 pm... How to do a rename that just lists filename-Month-Day-Year.ext Does anyone have any idea?

Code: Select all

namedate -Z="m-d-Y" "filename.txt"
-Z="str" or --FormatDate="str" Specify the date/time format
...
-Z and --DateFormat define how the date should be formatted. The following
placeholders are used:

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
---

Something similar using sarch (which you would probably use in a batch file which would accept arguments):

Code: Select all

sarch /filename "filename" /execute "copy {Config.filename}.txt {Config.filename}-{Time.MonthPad}-{Time.DayPad}-{Time.Year4}.txt"
Both programs can use offsets which may be particularly be useful.

User avatar
webfork
Posts: 10818
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Re: NameDate

#4 Post by webfork »

lintalist wrote: Sun Dec 13, 2020 1:51 am

Code: Select all

namedate -Z="m-d-Y" "filename.txt"
---

Code: Select all

sarch /filename "filename" /execute "copy {Config.filename}.txt {Config.filename}-{Time.MonthPad}-{Time.DayPad}-{Time.Year4}.txt"
Excellent, thanks :)

Post Reply