Export folder listing to file

I currently have a text file that contains the folder structure of four different folders. I use the "Export folder listing" feature to create the listing and then paste it to the text file. Before the actual listing I write the total size of the root folder.
The files in those folders change frequently and I have to update this text file every few days.

Is it possible to create a button that exports the folder listing of all four folders to that file automatically and adds a short header with the total folder size before each listing?

You can automate things slightly using the Print FOLDER command:

Print FOLDER "C:\Folder\Path" AS=csv TO "C:\Listing\Path\List.csv" QUIET

(You can use different arguments to change the output type or specify a folder format for different columns, etc.)

The best way to include all four folders depends on how the folders are arranged.

If they are all below a common place then you can use a single command to output a listing for the common parent folder, along with a filter to exclude any other unwanted folders.

If they aren't, then it gets a bit more complicated and might require two separate buttons (one to generate all the listings, another to join them all together after the first stage is done). (We might be able to make that easier in a future version, so it could all be done in a single click even in this case.)

No, the folders are not below the same place.

I tried to make a button that creates a separate file for each folder.

Print FOLDER "G:\Folder1" AS=txt CALCSIZES=yes ENCODING=utf8 FLATVIEW=grouped HEADER=none FORMAT="Dateiname und Größe" TO "C:\Target\file1.txt" QUIET Print FOLDER "F:\Folder2" AS=txt CALCSIZES=yes ENCODING=utf8 FLATVIEW=grouped HEADER=none FORMAT="Dateiname und Größe" TO "C:\Target\file2.txt" QUIET Print FOLDER "D:\Folder3" AS=txt CALCSIZES=yes ENCODING=utf8 FLATVIEW=grouped HEADER=none FORMAT="Dateiname und Größe" TO "C:\Target\file3.txt" QUIET Print FOLDER "D:\Folder4" AS=txt CALCSIZES=yes ENCODING=utf8 FLATVIEW=grouped HEADER=none FORMAT="Dateiname und Größe" TO "C:\Target\file4.txt" QUIET

However, this creates the first file only. Do I need to separate the instructions somehow? I tried semicolons but this wouldn't work either.

The specified format contains a filter to exclude some folders. This works when browsing folders with Opus but the filter is ignored when I use it to print the folder. I want to exclude all folders named "AUDIO_TS" or "VIDEO_TS". I tried to use the FILTER Argument "~(AUDIO_TS|VIDEO_TS)" but this didn't work.

The Print command blocking further commands was fixed in 10.0.2.1-beta (link in my signature).

You could use something like this to automate most of the work (assuming you have a Header.txt somewhere to insert between each file):

(I've left out the other Print FOLDER arguments, and only done it for three folders, to make the example easier to follow. The Join command is still very long and likely to be line-wrapped.)

Print FOLDER "G:\Folder1" AS=txt TO "C:\Target\file1.txt" QUIET Print FOLDER "G:\Folder2" AS=txt TO "C:\Target\file2.txt" QUIET Print FOLDER "G:\Folder3" AS=txt TO "C:\Target\file3.txt" QUIET Join FROM "C:\Target\Header.txt" "C:\Target\file1.txt" "C:\Target\Header.txt" "C:\Target\file2.txt" "C:\Target\Header.txt" "C:\Target\file3.txt" TO ""C:\Target\Joined.txt" Delete "C:\Target\file(1|2|3).txt" QUIET

If you want the folder to exclude (AUDIO_TS|VIDEO_TS), use that as the wildcard name pattern and set the line it is on to "Not Match" instead of "Match".

Thank you very much for your help. The button is now generating the file as intended.

But the filter is still not working. I tried several filtering options but even if I set the filter to match only one specific file the entire folder is printed.

Are you adding something like FILTER=(AUDIO_TS|VIDEO_TS) into the command itself?

If so, what you need to do is specify the name of a filter in the command, and separately create a filter to do what you want under Preferences / File Operations / Filters.

(You can also create filters via the Find panel, which might be easier as you can test the filters there as well, and the window can be resized.)

I'm already doing it that way.

I create a filter called "Test" and then add FILTER Test to the Print command. I also tried FILTER=Test and FILTER "Test". But the filter is always ignored.
The strange thing is that its actually working if I use the printing dialog and choose my filter there.

Ok, I think this is a bug.

I created a button with the following command:

Print FOLDER="G:\Medien\Filme" AS=txt CALCSIZES=yes ENCODING=utf8 FILTER="TestFilter" FLATVIEW=grouped FORMAT="Dateiname und Größe" HEADER=none TO=clip

Without the "QUIET" attribute it creates the following dialog:


As you can see everything except the filter is preset correctly.

Any news about this? Can you confirm this issue or is this only happen to me?
I'm running Directory Opus 10.2.0.5 and still experiencing the same problem.

Not yet, sorry. It's still on our list, but under a bunch of other things.

Ok, thanks for the update.