Dear all,
I have a script that sends a copy of a file to a folder
$SelectedItems = get("SelectedItemsPathNames", "|"); copyto "C:\OLD.FILES", $SelectedItems;
Now I would like that the copied file (not the original) is renamed once in the destination folder so that the date is added to the file name.
Up to now I obtain this result by manually selecting the file
using this script:
::rename , '*.<datem yymmdd>'
Than copying the file
$SelectedItems = get("SelectedItemsPathNames", "|"); copyto "C:\OLD.FILES", $SelectedItems;
And finally manually removing the date to the original file.
Any chance to merge all these tasks into a single script?
Thank you
Script to copy a renamed copy of a file to a folder
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Script to copy a renamed copy of a file to a folder
Code: Select all
$dst = "C:\OLD.FILES";
if (exists($dst) != 2) { new($dst, "dir"); }
foreach($item, <get SelectedItemsPathNames |>, , "e") {
if (exists($item) != 1) { continue; }
copyitem $item, "$dst\*.<date yyyymmdd>.?";
}
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club