I've been searching for a long time now and can't find an answer.
Is it possible to search for folders containing specific files ?
In my case I would like to find all folders containing MP3 of a specific genre (I only want folders, not files).
If anyone has an answer to that it would be very appreciated.
I would do this by using either the Utility Panel or the Find Dialog to create the following simple filter (this one would locate country music songs):
Run that filter on the base folder of your mp3 tunes making sure you have the "Search inside subfolders" option ticked. Then in the output window (or file collection) where you should see a list of all songs matching the genre you entered, click on the "Location" column to sort the genre selected songs by folder location. That will allow you to select each unique folder for the genre and from there you should be able to do whatever you want with those folders.
[quote]That will allow you to select each unique folder for the genre and from there you should be able to do whatever you want with those folders.[/quote]That's exactly where the problem is. I assume you must select all directories manually (I don't know any other way). And that's a really tedious job when you have many.
Well then I'd do the above as a starter, and in the output window, select all the returned results, copy the full paths of the songs to the Windows clipboard, then paste those full paths into a new empty text file and save it. In my example below that text file would be:
C:\temp\file1.txt
Next I would create a new batch file to process the full paths in the above text file, to generate another new text file containing the names only the unique folders, in other words no duplicates. Note you will need at least Windows NT or newer for my example to work.
The second generated file in my example is named:
C:\temp\file2.txt
When all is done file2.txt should contain what you want.
Also note that you could run the batch file from a DOpus button or just by double clicking on the name of it in a DOpus lister. Make sure you end your batch file name with either .bat or .cmd e.g.
C:\test\mybatch.cmd
Here is the script:
rem BEGIN BATCH FILE
@echo off
:: Text file to paste all folders into
set FILE1=c:\temp\file1.txt
:: File that will be generated with
:: only unique folder names
set FILE2=c:\temp\file2.txt
:: If second file pre-exists, delete it
if exist "%FILE2%" del "%FILE2%"
for /f "tokens=*" %%a in ('type "%FILE1%"^|sort') do (
call :process "%%~dpa"
)
pause
exit
:process
if not "%X%" == "%~1" echo %~1>>%FILE2%
set X=%~1
goto:EOF
rem END BATCH FILE
The thing is I would like to manipulate these directories after (e.g. copy, move, compress,...). Do you think it would be possible to see it as a file collection that would be updated manually (or automatically) ?
As far as I know a file collection is for files, not folders. What is your ultimate goal here?
Also, I know my suggestions are taking the long way around resolving a problem, however it's the only way I can think of to do this. Perhaps someone else has a better idea.
If DOpus ever has an internal scripting language then perhaps one day problems like this can be resolved entirely within DOpus.
My mp3 folders are very well classified (by artist - album) so you can have only one genre per directory. Adding a column genre for directories is what I would like, so I can sort directories this way. Unfortunately it doesn't work, so I'm trying to find workarounds for that...
I don't think I'm quite following you yet, but have you tried this?
Go to the base folder containing mp3s
Put lister into flat mode
Have a toolbar button set up that has the following command: Set COLUMNSTOGGLE=columnlist
From that toolbar column list, choose MUSIC and make sure the genre and artist columns are ticked so they will be displayed. At this point you should see a list of all your mp3s including the genre and artist columns
Click on the GENRE column header to sort the lister by genre. If it is reversed sorted, just click on that genre header again.
Last, hold the CTRL key down and click on the ARTIST column to have a second level priority sort by artist name.
Whoops, I had a typo last time. Instead of adding the ARTIST column, add the LOCATION column from the general section. The location column contains the folders.
Then I'm at a dead end here. I can get you a list of the genre folders, I can open a new lister tab for each genre folder, but apparently none of this is what you want.
It's a valiant attempt John !
I think what Marsup wants is the Genre column to display info on the contents of folders,
without displaying the files in the folder.
descript.ion files are the only thing I know of that can accomplish this.
The column header would then be for descriptions.
PHP command line scripting could accomplish this.
PHP has a library of ID3 tag functions.
However, PHP command line scripting is still in its' infancy.
There are many dangers in running bad PHP command line scripts in windows.
For instance, a system ("pause") stops the script from closing when run normally,
but will freeze if run from an advanced editor.
The PHP command sleep ( seconds ) averts this bad crash.
These things are essential to read PHP warnings and programmer output when the script has command line input.
I'm beginning to gather things I've done in PHP on Linux and write a 'Hello World' tutorial to PHP command line scripting.
However, this topic is well beyond the scope of a 'Hello World' HTML tutorial.
Recursive directory searches are 'easy' in PHP and it's not too difficult to accomplish this,
but noone has ever posted anything on DOpus and PHP scripting.
There are many more important topics to discuss first.
I'm not sure that I know what you're trying to do exactly, either, but how about this:
Use the "descript.ion" feature for each folder and add the "Description" column to your file view, then sort that way. Example: You find a folder that you'd like to classify using the "Rock" genre. Create a button whose command is "SetAttr DESCRIPTION". Select the folder(s), then click your new button. This will bring up a dialog box asking for the description of the folder. Type "Rock". Click OK. Then right-click on the columns in your file view, and click on "Description". This adds the description column to your view, which you can use in your sort order. It's not quite the same as a "Genre" column, but as you said, that's not possible. This is a workaround. If you already use the "descript.ion" feature with other folders, then instead of typing "Rock" as your description, then you could type "Genre: Rock". Then when you sort by the description column, all your genres would be sorted together.
If it's the only solution, I'll have to find a way to do that then.
I thought it could be done by search at first because, to me, it looked very much like a condition (a bit like searching for a file that contains text).
We're getting closer to the solution, thanks guys