Import & Export -> Text Export - Expoort Folder Names Only

Started by Darius1968, June 15, 2021, 09:10:05 AM

Previous topic - Next topic

Darius1968

I want a full recursive list of folder names for any given folder(s) that I submit to the Text Export module, but I only want the folders (and, not individual files) to be considered for the report. 

So far, despite the fact that I'm generating the file with "{File.MD.photools.com::IMatch\101400\file.foldername\0}", which only parses the folder names, I'm getting x number of entries for each individual folder, where x = the number of files in that folder.  How do I put a stop to this, and only get one entry for each folder? 

Mario

The text export is based on files, not folders. The export steps are performed once per file. You cannot achieve what you want with the text exporter, unless you select exactly one file per folder.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Are there any other options in IMatch that would allow for what I'm trying to accomplish? 

Mario

Select the folders and press Ctrl+C. Paste into Notepad?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

That is EXACTLY what I would do (have done many times!), if it were just a small subset of folders (and their subfolders) that I were concerned about.  However, I'm concerned about each and every folder that is managed in my database (5,362), and selecting all of these will cause a hang-up, because it's trying to copy all of my files to the clipboard, as well!  So, I would need an alternative method for this, or is this something that is outside of the scope of possibilities, where IMatch is concerned? 

Mario

Open your web browser and use this URL:

http://127.0.0.1:50519/v1/folders?id=all&recursive=true&fields=path&auth_token=

This lists the paths of all folders in your database in JSON format. Sorted by path.
Select and copy into a text file for further processing.

You can also write a small IMatch app, with this code at the core:


IMWS.get('v1/folders', {
    id: 'all',
    recursive: true,
    fields: 'path'
}).then(response => {
    for (const folder of response.folders) {
        console.log(folder.path);
    }
}


This statement fetches the paths of all folders and outputs them to the browser console. Instead you could also just add them to a string and then use
the writeTextFile function in the IMatch helper class to save them to a text file.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Thanks for the code - Appreciated.  I'll check it out. 

ubacher

Could you not just use text export to write the path of each file, then use a text editor to eliminate duplicate lines.
(Sort first). I am thinking of notepad++.

Darius1968

Ubacher, again, there is a BIG DIFFERENCE between 5,212 folders and 402,569 files!  402,569 entries would take a lot more processing power, and at that, it would be a lot of processing power, FOR NOTHING!  It could also hang the system. 

JohnZeman

Outside of IMatch if you have a good file manager it should be able to give you want you want.

I've been using Directory Opus as long as I've been using IMatch and between the two I can easily do anything I want including what you're asking for.

ubacher

I tried text export with my 300000 files. It took many seconds to drag the files to the text exporter.
The export took about 3 minutes.
Eliminating duplicate lines with notepad++ was near instantaneous.

sinus

Quote from: ubacher on June 16, 2021, 06:55:55 AM
I tried text export with my 300000 files. It took many seconds to drag the files to the text exporter.
The export took about 3 minutes.
Eliminating duplicate lines with notepad++ was near instantaneous.

The same here, exactly like ubacher wrote, no problem with my 306'954 files, it took also about 3 minutes.
I have not tried to eliminate the duplicates, but I know, this is not a big problem and I have no doubt, that ubacher is correct here.

I do not think, that is a very big difference between 300'000 and 400'000 files to do so, but of course, I do not know.
Best wishes from Switzerland! :-)
Markus

Jingo

Quote from: JohnZeman on June 16, 2021, 05:45:51 AM
Outside of IMatch if you have a good file manager it should be able to give you want you want.

I've been using Directory Opus as long as I've been using IMatch and between the two I can easily do anything I want including what you're asking for.

Same here.. I use XYPlorer and it can do just about anything you can imagine with files... even complex scripting.  While I use IM for a ton of things - file stuff I leave to XYPlorer.

Darius1968

JohnZeman and Jingo - About Directory Opus and XYPlorer:

Can either of these enable the user to list the entire hierarchical folder structure of a given storage device, sorted with respect to ascending/descending length (in character-count) of the fully-qualified folder-name, as well as providing a 2nd-column, listing the character-count for each folder? 

Can they diagnose problems with the folder structure itself, ie., whether or not the folder-name itself it too long, or is made up of illegal characters? 

Thanks

JohnZeman

With Opus I don't recall it being able to perform disk diagnostics however you can put the folders in flat view to sort the results by the total path length of the folders.

Attached is a folder flat view screenshot of the folders and subfolders where I store the photos in my IMatch database.


Jingo

Same with XY... it does a lot but diagnostics - I would use other software such as TreeSize (another amazing software for viewing disk space/files, etc).

With both XY and Opus - you can do most of what you wish with scripting... but would need to learn the ropes a bit.