ReNamer:Scripts:Date and Time

From den4b Wiki
Revision as of 16:00, 8 February 2017 by Den4b (talk | contribs) (Text replacement - "<source>" to "<syntaxhighlight lang="pascal">")
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.

<syntaxhighlight lang="pascal"> var

 DateTime: TDateTime;

begin

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

end. </source>