Here's the weirdest thing... if I run this script in 'try script' mode, it works perfectly. As soon as I try to run the script on a folder with many files in it, it just locks up XY and the whole thing crashes.
Anyway, here's the script followed by a description of what I'm trying to do:
Code: Select all
sel 1;
while ( <curbase> != '' )
{
$B = <curbase>;
$Name = regexreplace($B, (.+)@(.+)_(.+), $2); // $2 should return the BASENAME of the file
moveto "C:\Organized\$Name", , , 2;
sel 1;
}
What I'm trying to do is to simply run through the list of all files in the folder, extract the basename for each file, then move the selected file into a new folder based on the basename.
So,
oonsgsgdt@TEST_iuihksf would be moved into Organized\TEST
iibienr@ANOTHERTEST_oououns would be moved into Organized\ANOTHERTEST etc etc.
I'm sure this should be a 30 second job, but having tried for hours I'm stuck!
Thanks for any help.