Hi!
I would like to ask how its possible to rename a file/folder to contain tomorrows or yesterdays date? Like: " Rename pattern *.* TO *_{date|yyyy.MM.dd}.* " but like in MS Excels VB macros there is a (date +1) command so i get current date +1, tomorrows date. I would like to create rename buttons with internal commands.
Thanks!
There's are built-in codes to add and format the current date/time and also various dates/times to do with the file (e.g. modified date), but they don't allow for adding a day or other arithmetic.
For that, a small rename script can be used instead:
function OnGetNewName(getNewNameData)
{
var d = new Date(); // Today
d.setDate(d.getDate() + 1); // Move date part to tomorrow.
var dd = d.getDate();
var mm = d.getMonth() + 1; // Jan=0,Feb=1,etc.
var yyyy = d.getFullYear();
if (dd < 10) dd = "0" + dd; // Pad to 2 digits
if (mm < 10) mm = "0" + mm; // Pad to 2 digits
return getNewNameData.item.name_stem + "_" + yyyy + "-" + mm + "-" + dd + getNewNameData.item.ext;
}
Thank you very much! Works! (So i saved this as a rename preset and made a button that calls for it. In case anyones wondering)
1 Like