#1 2020-01-13 00:05

tom.amitai
Member
Registered: 2013-04-18
Posts: 5

Rename with yesterday's date?

I know next to nothing about using Pascal scripts and am having trouble creating one that will rename a file to the previous day's date based on the system date when run. For example, changing original file name from "Gibberish.txt" to "2020-01-11.txt" I tried using "-24" in the hour span script but that didn't work. Can someone please help me with this?

Offline

#2 2020-01-13 03:45

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Rename with yesterday's date?

You don't necessarily need the Pascal Script rule, because you can adjust date/time in the filename using the Reformat Date rule.

So you can simply insert the current system date time using the ":Date_Now:" meta tag, and then adjust it by -24 hours or whatever you need.

renamer-adjust-time-150dpi.png

Offline

#3 2020-01-13 03:49

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Rename with yesterday's date?

For the same of completeness, here is a script for inserting yesterday's date into the filename using the Pascal Script rule:

begin
  FileName := FormatDateTime('yyyy-mm-dd', IncDay(Now, -1)) + WideExtractFileExt(FileName);
end.

Offline

#4 2020-01-13 17:57

tom.amitai
Member
Registered: 2013-04-18
Posts: 5

Re: Rename with yesterday's date?

den4b wrote:

You don't necessarily need the Pascal Script rule, because you can adjust date/time in the filename using the Reformat Date rule.

So you can simply insert the current system date time using the ":Date_Now:" meta tag, and then adjust it by -24 hours or whatever you need.

Thanks, I didn't even notice that function!

Offline

Board footer

Powered by FluxBB