My goal with this script is to have the user select a single file and run the script, which will create a directory with the same name as the <curbase> of the selected file and move all files with that name to the new directory.
My script:
"Create FOLDER from filename and move FILE to FOLDER"
$Folder=<curpath>;
$NumSelected=<get countselected>;
if ($NumSelected==1)
{
$BaseName=<curbase>;
$Ext=<curext>;
msg "The parts are: <br> FOLDER=$Folder <br> BASENAME=$BaseName <br> EXTENSION=$Ext";
if ($Ext=="")
{
msg "You have selected a directory named $BaseName <br> I am not creating a new directory";
}
else
{
msg "You have selected a $Ext file <br> Creating a new FOLDER called $BaseName";
//new($BaseName,"dir");
moveto ($BaseName, <curbase>.*,,3,,0,0,1,0,0,0,0);
}
}
else
{
msg "You selected $NumSelected items. Please select only one.";
}
------------------------------------------------------------------------------------------------------------
The test files:
foo.bar
foo.pbr
foo.jpg.txt
foo.txt
When I run the script, it all works great except I get this error in the log file:
Processed files (including 1 folder):
FAIL (move intra vol) New E:\XYPlorerTest\foo\ -> E:\XYPlorerTest\foo\foo\ | The parameter is incorrect.
New E:\XYPlorerTest\foo.bar -> E:\XYPlorerTest\foo\foo.bar
New E:\XYPlorerTest\foo.jpg.txt -> E:\XYPlorerTest\foo\foo.jpg.txt
New E:\XYPlorerTest\foo.pbr -> E:\XYPlorerTest\foo\foo.pbr
New E:\XYPlorerTest\foo.txt -> E:\XYPlorerTest\foo\foo.txt
I thought that by setting the 4th parameter of the MOVETO command to 3 that I am telling it to process only files, so I would think that it wouldnt even be trying to process directories (the newly created directory), which is what seems to be causing the error.
I have an inkling that this relates to the text in the error "move intra vol" (as opposed to an "inter volume" move), but I am not sure what I am doing incorrectly.
Problem with MOVETO command
Re: Problem with MOVETO command
Code: Select all
"Create FOLDER from filename and move FILE to FOLDER"
end (<get countselected> != 1), "You have to select exactly ONE file, aborted!";
end (exists(<curitem>) == 2), "The selected item is a folder, aborted!";
moveto <curbase>, listfolder(, "<curbase>*", 1),,2,,0,0,1,0,0,0,0;
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club