ReNamer:Scripts:Date and Time

From den4b Wiki
Revision as of 23:28, 7 September 2010 by Den4b (talk | contribs) (Created page with '{{Up|ReNamer:Scripts}} This script demonstrates how to extract file dates, format them, and put them into the filename. == Code == Author: Denis Kozlov. Date: 13 February 2007…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This script demonstrates how to extract file dates, format them, and put them into the filename.

Code

Author: Denis Kozlov. Date: 13 February 2007. Append last modified date to the end of the filename, in a dd-mmm-yyyy format.

var
  DateTime: TDateTime;

begin
  DateTime := FileTimeModified(FilePath);
  FileName := WideExtractBaseName(FileName) +
    FormatDateTime(' (dd-mmm-yyyy)', DateTime) +
    WideExtractFileExt(FileName);
end.