ReNamer:Scripts:Date and Time

From den4b Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.