dates and times

Purpose

The aim here is to parse your file-names identifying suitable textual file dates and times, where you have incorporated something suitable in the file-name. Suitable dates can be re-used by saving file-choices as favourites.

 

file_utilities_date_parsing

Mask Syntax

The procedure reads any file-names in the Folder to process (and optionally its sub-folders) and attempts to parse them. If an indicator is found it will record a suitable date combination.

Suitable indicators of textual date are

 

YY or YYYY        year, two or four digits (YY=a 20th Century date)

MM                month

DD                        day

*                        skip all characters until a digit is found

 

The procedure doesn't understand words such as "December" or "Five", it only uses digits. Any character other than Y,M,D,* in the mask simply gets ignored.

 

Output

The program will always add each entry found to a simple text file (File for list of dates) listing its file-name and adding a suitable date as expected in the auto-date procedure, (or <no date found> if the mask didn't match a valid date). In addition, where the result is 1st January 1980 or later, it will set the file's time and date in the operating system to the date as parsed, so that WordSmith will automatically match the date of the text contents to the date stored on disk.

When all files have been processed, the program opens the list of files in Notepad or equivalent. Use it afterwards in the auto-date procedure within file-choosing and save your preferred text files as favourites.

 

Examples

Your Mask

Source file

Date and Time interpreted

YYYYMMDD

20060512 Peter monologue.txt

12th May 2006 (first 8 characters used in the mask)

YYMMDD

841231.txt

31st December 1984 (20th Century assumed if YY mask used)

DDMMYY

311284.txt

31st December 1984

DDMMYYYY

20060512 Peter monologue.txt

20th June, the year 512 AD

DDMM

20060512 Peter monologue.txt

20th June of the current year

######YYYYMMDD

Peter 20060512.txt

12th May 2006 (first six characters were ignored, five for Peter, one for space)

*YYYY

Peter 20060512.txt

15 July 2006 (all characters to first digit skipped, then next 4 used for year date)

YYYY

1086 Domesday book.txt

15 July 1086 (there were only four digits)

YYYYMMDD

1086 Domesday book.txt

15 July 1086 (mask had 8 digits but file-name only 4)

YYYY#MM#DD

2006,05/12,10-54.txt

12th May 2006

YYYY MM DD

2006,05/12,10-54.txt

12th May 2006







 

 

Click the Permalink button if you want to copy a link to this page.