Initiating a rescan of a folder via scripting

Started by ubacher, June 15, 2017, 09:52:44 PM

Previous topic - Next topic

ubacher

I am in need of a way to initiate a rescan of a folder (and optionally its subfolders) from a script.
(As was available in IM5).

Mario

Folder rescans are automatic. I know that you for some reason have disabled this automatic functionality.
IMatch WebServices automatically rescans folders automatically, there is no option to disable this. I don't know if it will be effective to implement this functionality just for one user who combines scripts and a disabled automatic folder rescan. Lets's see how many +1 this gets.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

QuoteIMatch WebServices automatically rescans folders automatically

But when I moved a file to a sub-folder in my script it did not add the file to the folder. (reported elsewhere).
What would I have to do (in a script) to show/test this automatic rescan?

Mario

As the documentation of the IMatch.moveFile function say: This is for using normal files, not moving files which are indexed in your database. This functions exists because JavaScript cannot access the file system.

As I wrote yesterday, you will have to wait until I figured out a safe way to implement a moveFile / copyFile / deleteFile / ... function in IMWS itself. Such an endpoint will keep the database up-to-date automatically.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

I assume doing it in IMWS is difficult.
I don't need IMWS - I only run embedded. Would that be much easier?

Mario

All database-related functionality provided in IMatch is provided by the embedded IMatch WebService. IMatch only provides application-specific functionality on top of that.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben


Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

JohnZeman

I'm a total novice with JavaScript at this point in time so you might already know this but here is how I'm going to and rescanning a folder.

<input id="buttonrescan" type="submit" onclick="myFunction();" value="Go to !Queue and Rescan it">

// RESCAN !QUEUE ///////////////////////////////////////////////
document.getElementById('buttonrescan').onclick = function() {
// Select the !Queue Folder
     IMatch.gotoFolder(91,0).then(function(response) {
      IMatch.focusWindow('filewindow.active');
      IMatch.commandExecute('ID_CMD_FOLDER_SCANFOLDER');
     });
};

ubacher

I too managed to get this going some - I think I reported it.

IMatch.focusWindow('mediafolders.tree').then(function (response) {
               
                IMatch.commandExecute('ID_CMD_FOLDER_SCANFOLDER');
                IMatch.modalClose()
            })


But this does not solve the problem of moves/copies and renames via scripting which don't
add the result to Imatch. Mario is working on this (I think/hope - since its my holdup now for using IM 2017)