Hello, I need a quick script to append date that is a day before the file was modified, so if a file was modified today, the append date would be yesterday (today-1).
how do I modify below script to do just that? thx.
|"append modified date" \;*>::rename "b", "* <datem mm-dd-yy>"
modified date script help
-
admin
- Site Admin
- Posts: 65083
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: modified date script help
You'd need some DateDiff function to get this right. This is currently not supported by scripting.jsc572 wrote:Hello, I need a quick script to append date that is a day before the file was modified, so if a file was modified today, the append date would be yesterday (today-1).
how do I modify below script to do just that? thx.
|"append modified date" \;*>::rename "b", "* <datem mm-dd-yy>"
Strange wish, BTW.
FAQ | XY News RSS | XY X
Re: modified date script help
I'm the living oracle of excel, guess I'm trying too hard to solve everything with formulaadmin wrote: You'd need some DateDiff function to get this right. This is currently not supported by scripting.
Strange wish, BTW.
Re: modified date script help
<shameless plug>admin wrote:You'd need some DateDiff function to get this right. This is currently not supported by scripting.
Strange wish, BTW.
Actually, that can be done with common-jacky. Quickly (and untested, but I believe it should work as expected):
Code: Select all
"date"
$day = <datem dd>;
sub ($day == 1) ? '_doMonth' : '_nothing';
end $day == 1,,1;
substr $day, "0" . ($day - 1), -2;
rename b, "* <datem mm>-$day-<datem yyyy>";
"_doMonth"
global $CJ_date, $CJ_day_number;
$CJ_date = <datem dd/mm/yyyy>;
load "common-jacky", "_getNumberFromDate";
$CJ_day_number = $CJ_day_number - 1;
load "common-jacky", "_getDateFromNumber";
substr $day, $CJ_date, 0, 2;
substr $month, $CJ_date, 3, 2;
substr $year, $CJ_date, -4;
rename b, "* $month-$day-$year";
"_nothing"That being said, some date functions have been on my list for a while, though I somehow never got to actually wish it here. But on many occasions it could be useful, and the CJ trick while it work just fine, isn't the fastest. Maybe to add on your list somewhere, Don, could be some functions like datediff() & dateadd()
Proud XYplorer Fanatic
-
admin
- Site Admin
- Posts: 65083
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: modified date script help
Whoops, yep, dateadd() was the one needed here, not datediff(). Yes, maybe laaaaaater...jacky wrote:Maybe to add on your list somewhere, Don, could be some functions like datediff() & dateadd()
FAQ | XY News RSS | XY X
Re: modified date script help
wow, this really works!
Re: modified date script help
btw, can this script be added to right drag move context menu? and if so, how? thx.
-
admin
- Site Admin
- Posts: 65083
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: modified date script help
No, but maybe later with Custom Event Actions...jsc572 wrote:btw, can this script be added to right drag move context menu? and if so, how? thx.
FAQ | XY News RSS | XY X
XYplorer Beta Club