Batch Renaming Folders

Started by Mike, May 09, 2023, 11:40:43 PM

Previous topic - Next topic

Mike

Hi,

batch renaming of folders would also be a feature I would expect from Renamer. However, that doesn't seem to work. Does anyone know of an acceptable alternative?

My problem is not exactly small, there are over 8000 folders that need to be renamed. They already have meaningful names, but they would have to be edited in detail (e.g. spaces or commas would have to be replaced by other characters, etc.)

All folders are already part of the database, so being able to do it from within iMatch would be highly desirable.

Any idea? Thanks in advance!

Mario

Please do not post questions in a board that is intended to post tips & tricks to other users.
Don't just pick any board when posting. Read the description under each board name before posting.
If in doubt, post in in General Discussion and Questions
I will move your post there this time.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

Quotebatch renaming of folders would also be a feature I would expect from Renamer. 
Your expectation is incorrect. The Renamer does not rename folders, only files.
It can move files into dynamically named and created folders, so this might be something you might want to look into.

Occasionally renaming a folder with <F2> or creating an entire folder hierarchy from a string of folder names is what IMatch can do in the Media & Folders View.

Frankly, having to rename 8,000 folders is something that not many users will ever have to do.
At least this was AFAIK never required, there is no related feature request in the feature request board...

If you need this and you think there might be other users who will need this, post a feature request in the feature request board. This allows other users to show support by liking your post. I always keep an eye on the feature request board.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mike

Yes, I've already noticed that Renamer doesn't rename folders ;) I'll make a "suggestion" in the appropriate board.

Of course, it's not about renaming 8000 folders frequently - this is an exceptional situation due to an own important and unavoidable conceptual change.

What happens far more often is that small groups of folders have to be changed at the same time. Already ten to twenty folders would be much more relaxed to rename in a batch process.

Mario

I'm sure there are dedicated tools that allow for batch renaming folders.
In a typical DAM context, this is virtually never needed.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mike

Yes, there are folder renaming apps out there, but renaming the folder from the outside would affect the database's connection to the files in the renamed folders. I would like to avoid something like that...

Mario

You could write a custom IMatch app, Python or PowerShell script, employing the /folders/rename endpoint.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mike

I'm not a programmer at all, but I'll think about it when I have more time and try to get an idea of what it would really take to do that and how I could do it with some help from AI, for example.

First of all, I would have to really understand the required basic concept of the project. From there I could start thinking about how to turn this into code lines and an app respectively.

For example, ChatGPT can program in Python and PowerShell, but only to a certain level of complexity and not too specific. I would have to see, if and what of it can really be useful, and if and how I can combine this with other information to make something useful out of it.

I hope my computer won't be lying in pieces on the sidewalk in front of the window afterwards ;)

mopperle

Another suggestion: Is it really necessary that you rename 8000 folders and then from time to time ten to twenty folders? Instead of thinking about to program something (especially since you are not a programmer), it might be worth to think about what exactly you want achieve and maybe change your workflow.

Mike

The required 8000 folder name changes are due to upgrades of a complex network of linked technologies for research purposes. There are new requirements that I cannot avoid.

The other occasional name changes that happen in smaller groups are necessary adaptations to dynamically changing research concepts from qualitative data analysis. It's a moving data situation that also requires experiments with various structural prototypes... I have to live with it.

But I also have a lot of "quiet" folders and data structures that vegetate in a relaxed manner, because no experiments take place there, only "normal" photos are managed. These, too, experience occasional classifications and typical DAM organization, but their folders have a nice, stable structure that is rarely challenged ;)

Mike

By the way: That's exactly what's great about iMatch, thanks to its flexibility and variety of functions, it helps me in many very different areas.

Mario

Quote from: Mike on May 11, 2023, 10:27:26 AMBy the way: That's exactly what's great about iMatch, thanks to its flexibility and variety of functions, it helps me in many very different areas.
See The IMatch Developer Center and Code Recipes for more information about the powerful web services the IMWS integrated in IMatch provides. Many IMatch features (People View, Event View, Dashboard...) are actually apps written using the IMatch Anywhere WebServices (IMWS) integrated in IMatch.

The web service allows you to access IMatch database contents from all programming languages which support calling web services, e.g. JavaScript, Python, C#, C++, Perl, curl and even Windows PowerShell!.

For example, this small PowerShell script lists the fully-qualified paths of all folders in your database (IMatch must be running):

# List all folders in the database.

$uri = "http://127.0.0.1:50519/v1/folders?id=all&fields=id,path,name,filescount,filessize&auth_token="

Invoke-RestMethod -Uri $uri | ForEach-Object {
    Write-Host ($_.folders | Format-Table | Out-String)
}

Save this to a text file with the name list-all-folders.ps1.
To run it, open a PowerShell command prompt and enter
.\list-all-folders.ps1
and press <Enter>

If you get a warning about scripts not allowed to run (Windows security feature), enter

Set-ExecutionPolicy RemoteSigned -Scope Process

and press <Enter> before running the script.

There are other examples, e.g. for Python, in the C:\ProgramData\photools.com\IMatch6\webroot\imatch folder on your disk.
If you have IMatch AnywhereTM you can even access IMatch databases running on another PC or server.

It is impossible (and would also be unwise) to implement all features requested by users. Most of the feature requests in the FR board don't get a single like, or sometimes only one or two (which are mostly 'nice to have' likes).
From experience I know that if a FR spawns discussions or gets a large number of likes in a short time, it is something that is important/helpful for a large number of users (most IMatch users don't participate in this community).

Every feature I implement in IMatch must be supported, documented and maintained for a virtually infinite amount of time. So I have to be careful when choosing where to spend my IMatch development time.

For highly-specialized features that are maybe useful for one, two or a handful of users, writing an app or script is the way to go. IMatch users from the corporate and scientific world can use that to link IMatch with other systems, export and import data in specific form and whatnot.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mike

Thanks for the tips and sample code. As soon as I have more time I will try to form a complete solution from all this and other information.

Of course, programming is only worthwhile if it helps a relevantly large number of users. I understand completely.