Need a little help on my archiving script
Posted: 13 Feb 2019 16:52
Hi all
Haven't been here for a while, still a very very happy XYplorer user :-)
With your help, I created a little script that takes my files from a specific folder and moves them into dated subfolders:
This works perfectly fine, but one thing is missing: It should only move files older than X days, where X should be taken from the confirmation dialog (if that's possible, otherwise hardcoded).
I have tried a few things a while ago, but I forgot what exactly. What I remember is that it didn't work :-)
Any hint highly appreciated!
Cheers
André
Haven't been here for a while, still a very very happy XYplorer user :-)
With your help, I created a little script that takes my files from a specific folder and moves them into dated subfolders:
Code: Select all
if (confirm("Archive?", , , 4)==1) {
$root = "D:\_inbox\";
foreach($file, listfolder($root)) {
$folder = $root . regexreplace(property("#date.c",$file), "^(\d+)(?:\.|-|/)(\d+)(?:\.|-|/)(\d+)(.*)", "..\_archive\$3\$2") ;
moveto $folder, $file, , 2;
}
}
I have tried a few things a while ago, but I forgot what exactly. What I remember is that it didn't work :-)
Any hint highly appreciated!
Cheers
André