Renaming files

Started by samisbp, August 31, 2017, 10:30:27 AM

Previous topic - Next topic

samisbp

Hi

I am in the process of re-writing my old IMatch5 scripts to be compatible with the new IMatch App system.

One of them consisted in renaming a bunch of selected files automatically and applying specific filenaming standards, which was for me much faster then going through the file naming functionality of IMatch.

The best function I have found so far is fileMove(). But it seems to take quite a bit of time to process as between the time the app is run and the new filename appears in IMatch file window is almost 15 secs !
Am I not using the correct function, or any ideas what I may be doing wrong ?

Thanks

samisbp

While thinking about this, am I right in thinking that when using fileMove() just to rename a file, this function takes a long time if the file is big (as it needs to copy all bytes of that file even if it stays at the same location).
So is there a function that only just renames the name of a file ?

samisbp

Just as a last info, in my old script, I was using Database.RenameFile and that was working very fast.

Mario

Did you read the documentation of this function?
It moves the file in the file system and is not designed to be used with files already indexed by your database.
The current IMWS in IMatch has no features to rename or move files indexed by the database. This will follow in a later stage. We have discussed this in the developer board, which you should follow when you plan to write apps for IMatch.

As for the performance., I cannot say anything about this. The moveFile function relies on Windows functions to rename or move the file.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

samisbp

Thanks Mario.

Yes I did read the documentation about the function and that's why I got the feeling that was not really appropriate for my needs.

So are you saying that I do not have at the moment an alternative to the old Database.RenameFile ?

Mario

#5
QuoteSo are you saying that I do not have at the moment an alternative to the old Database.RenameFile ?

Correct. The current version of IMWS only permits changes to selected database objects, categories, metadata and Attributes.
STAGE 3 of IMWS will include functions to manipulate files and folders. See the Developer Board where I keep interested users up-to-date with things planned and in the works.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

samisbp

Any ideas when such functionalities will be available (just so I know if I need to find some other alternatives in the mean time).

thrinn

Taking this post into account https://www.photools.com/community/index.php?topic=7053.msg48954#msg48954, I figure it's not too far away...

In the meantime, I use a two-step approach: I put the "target" filename (and path) into an attribute, which is easy to do from an App. Then, I use the Renamer to move the file(s) to their respective location, renaming them on the way. Because the Renamer can make use of variables and variables are able to read a value from an attribute, this approach works well for me.
I trigger the Renamer step by hand, mostly because I want to have some control over it, but maybe this could be automated by using a favorite for this step and executing the favorite from the app. (I did not try this yet).
Thorsten
Win 10 / 64, IMatch 2018, IMA

samisbp


ubacher

Welcome to the "club" samisbp. I am ahead of you - I have converted all my important scripts except
for  the missing rename/move/copy/delete function. I also use the method of thrinn to rename files. In other cases
I put the files in a result window to perform the missing functionality manually. This way I am able to test most of the functionality
of the apps. Getting around the  asynchronous programming concept was the most difficult in the conversion.
Keep an eye out for this!

I am eagerly awaiting the missing functionality (next release?) so I can finish the apps and switch the production db to IM2017.