Multi Commander > Script
Rename & move/copy
Ulfhednar:
Updated
I've replicated the 3 variables sets for each operation & now can have multi-step renaming ops +copy/move.
Had a problem with <str> vs <array> in my Move op when selecting multiple folders but I've figured it out...!
This is the code I've appended for move:-
--- Code: ---@var $arr3 = GetSourceSelectedPaths();
@var $items3 = arrayCount($arr3);
@var $MoveNameFullPath;
@var $targetPath;
@var $sourceFile;
@var $n3 = 0;
for( $n3 = 0; $n3 < $items3; $n3++ )
{
$MoveNameFullPath = $arr3[ $n3 ];
$targetPath = GetTargetPath();
$sourceFile = $MoveNameFullPath;
MoveFile( $targetPath, $sourceFile );
}
--- End code ---
Hopefully my bungling will inspire others to use the scripting tools.
Now I'm wondering if I can rename files within a folder to match the updated folder name before I move the folder..... :P
Mathias (Author):
--- Quote from: Ulfhednar on August 25, 2013, 01:35:52 ---Now I'm wondering if I can rename files within a folder to match the updated folder name before I move the folder..... :P
--- End quote ---
Eh ?
You want to rename a folder and then you also want to rename the subitems in that folder before you move them ? Or ?
Use FileFiles to get an array with paths to all the files inside a folder.
Then you do that before or after you renamed the main folder.
and then move it.
Ulfhednar:
--- Quote ---You want to rename a folder and then you also want to rename the subitems in that folder before you move them ?
--- End quote ---
Yes.
I want to -
* select & update folder(s) name
* find & select files within the folder(s) matching *.xxx, *.zzz, *.ddd (i.e. match different file types in various folders)
* rename to match their parent folder.
* move the parent with updated contents
I still have some hair that hasn't been pulled out :D
OK, I will attempt to incorporate the findfiles function.
More rename +copy/move
This is an idea for another script for a button.
This would require the calling of hotkeys & waiting for the correct state of the item.
Specifically -
Can I invoke F2 on a selected item then auto copy/move it to target after the in-line edit has completed?
Best to ask if it is possible before I try to do it!
Mathias (Author):
--- Quote from: Ulfhednar on August 25, 2013, 13:50:09 ---Can I invoke F2 on a selected item then auto copy/move it to target after the in-line edit has completed?
--- End quote ---
Not sure why you want to do that.. Just get the information you need from the UI at the beginning of the script.
Also the script is run in the same thread as the UI. So the UI will not update it self until the script has run. However it is possible to run the script in a background thread. But not all script functions works then. And there are many strange things that can happen so it is not officially supported.
Ulfhednar:
I thought it might be useful/interesting to call a hotkey via script.
In this case my idea is probably not sensible. ::)
No problem. I'll think about different approaches.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version