photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: samisbp on August 31, 2017, 10:30:27 AM

Title: Renaming files
Post by: samisbp on August 31, 2017, 10:30:27 AM
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
Title: Re: Renaming files
Post by: samisbp on August 31, 2017, 10:42:42 AM
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 ?
Title: Re: Renaming files
Post by: samisbp on August 31, 2017, 10:43:53 AM
Just as a last info, in my old script, I was using Database.RenameFile and that was working very fast.
Title: Re: Renaming files
Post by: Mario on August 31, 2017, 11:13:20 AM
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.
Title: Re: Renaming files
Post by: samisbp on August 31, 2017, 01:16:52 PM
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 ?
Title: Re: Renaming files
Post by: Mario on August 31, 2017, 01:48:19 PM
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 (https://www.photools.com/community/index.php?board=128.0) where I keep interested users up-to-date with things planned and in the works.
Title: Re: Renaming files
Post by: samisbp on August 31, 2017, 02:53:59 PM
Any ideas when such functionalities will be available (just so I know if I need to find some other alternatives in the mean time).
Title: Re: Renaming files
Post by: thrinn on August 31, 2017, 07:08:21 PM
Taking this post into account https://www.photools.com/community/index.php?topic=7053.msg48954#msg48954 (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).
Title: Re: Renaming files
Post by: samisbp on August 31, 2017, 07:43:02 PM
thanks thrinn
Title: Re: Renaming files
Post by: ubacher on September 01, 2017, 06:52:16 AM
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.