How to search folders that contain certain files
Moderators: Hacker, petermad, Stefan2, white
How to search folders that contain certain files
TC has great search functions, but I have trouble to search for this.
For example, A folder has a bunch of sub folders like B1, B2, B3, ... etc. Some of these folders have file C, and some don't.
I want to search all B folders with file C. In other words, I want B folders as the search result not C.
Is this possible?
For example, A folder has a bunch of sub folders like B1, B2, B3, ... etc. Some of these folders have file C, and some don't.
I want to search all B folders with file C. In other words, I want B folders as the search result not C.
Is this possible?
This topic looks similar to http://www.ghisler.ch/board/viewtopic.php?t=39949; maybe the topics could be combined.
It is possible to get the "B" folders as the search result in TC, since addons are part of TC's capabilities. One way to do this is to use the DiskDir Extended addon. There are multiple steps, but they are easy.
0. First, install the DiskDir Extended plugin (http://www.ghisler.com/plugins.htm). Use of the extension .lsx is assumed here. (I use the .lst extension for the DiskDir plugin.)
1. Search for the files of interest (Alt+F7).
. Click on Feed to listbox, to create a virtual panel.
In the other panel, choose a target directory to hold the .lsx file that will be created.
2. Select all of the files in the virtual panel.
Open the Pack dialog (Alt+F5).
. Make sure that the name of the .lsx file to be created does not match an existing file in the target panel.
. Make sure that Also pack path names and Recursively pack subdirectories are checked.
. Using the Packer drop-down arrow, select the lsx "packer."
. OK.
3. Double-click on the .lsx file to cause TC to display the contents as a virtual directory structure.
Open the Search dialog (Alt+F7).
. Under the General tab, clear the Search for box.
. Under the Advanced tab, Attributes, select Directory.
. Start search and Feed to listbox.
If you want to see the directories in a virtual directory structure:
4. Select the files in the virtual panel that you just created.
Open the Pack dialog (Alt+F5) and use the lsx "packer" as above. The .lsx file to be created must not exist already.
Double-click on the second .lsx file to see the directories of interest. The .lsx file is just a text file, so it can be edited or used for other purposes.
It is possible to get the "B" folders as the search result in TC, since addons are part of TC's capabilities. One way to do this is to use the DiskDir Extended addon. There are multiple steps, but they are easy.
0. First, install the DiskDir Extended plugin (http://www.ghisler.com/plugins.htm). Use of the extension .lsx is assumed here. (I use the .lst extension for the DiskDir plugin.)
1. Search for the files of interest (Alt+F7).
. Click on Feed to listbox, to create a virtual panel.
In the other panel, choose a target directory to hold the .lsx file that will be created.
2. Select all of the files in the virtual panel.
Open the Pack dialog (Alt+F5).
. Make sure that the name of the .lsx file to be created does not match an existing file in the target panel.
. Make sure that Also pack path names and Recursively pack subdirectories are checked.
. Using the Packer drop-down arrow, select the lsx "packer."
. OK.
3. Double-click on the .lsx file to cause TC to display the contents as a virtual directory structure.
Open the Search dialog (Alt+F7).
. Under the General tab, clear the Search for box.
. Under the Advanced tab, Attributes, select Directory.
. Start search and Feed to listbox.
If you want to see the directories in a virtual directory structure:
4. Select the files in the virtual panel that you just created.
Open the Pack dialog (Alt+F5) and use the lsx "packer" as above. The .lsx file to be created must not exist already.
Double-click on the second .lsx file to see the directories of interest. The .lsx file is just a text file, so it can be edited or used for other purposes.
Thank you very much, Ralph!
It's a very interesting solution. I've never used this pack files function before.
After my second search, I got the B folders, but the "Feed to listbox" button is disabled. I guess this is the limitation when searching within a pack.lst file.
Besides, my goal is to move the B folders with C file to somewhere else, and leave B folders without C where they are. The pack solution can "Copy" the search result folders, but not move them.
It's a very interesting solution. I've never used this pack files function before.
After my second search, I got the B folders, but the "Feed to listbox" button is disabled. I guess this is the limitation when searching within a pack.lst file.
Besides, my goal is to move the B folders with C file to somewhere else, and leave B folders without C where they are. The pack solution can "Copy" the search result folders, but not move them.

Now I better understand your goal; you probably can skip my sections 3 and 4.
Here is a method to select the relevant actual (not virtual) directories, but the method is not elegant. Maybe someone knows a more convenient way.
. In the virtual directory created in my section 2 (or 4) above, select all directories (which will be those containing the files of interest).
. In the menu bar, click on Mark and Save Selection To File.
. Edit the selection file and remove the parent directory path d:\...\A\ for all entries. (This could be done via search and replace or via column block deletion in a program editor. Depending on your editor, you might need to change from Unicode to ASCII, for example while doing Save As from NotePad.)
. View the actual contents of your directory A.
. In the menu bar, click on Mark and Load Selection From File.
In this case, since you can use the method above to select the actual directories of interest, you probably will not need a bat file. If you want to create a bat file, you can use the MakeBat plugin.
DiskDir Extended is accessed via the Pack dialog because the Pack dialog will send a list of the selected files or directories to DiskDir Extended, and not because DiskDir Extended has anything to do with compression.
If the Feed to listbox button is disabled, I wonder if you are using the most recent version of TC. If you accidentally had used DiskDir instead of DiskDir Extended, I think you would not have been able to do the search for directories in my section 3.
Here is a method to select the relevant actual (not virtual) directories, but the method is not elegant. Maybe someone knows a more convenient way.
. In the virtual directory created in my section 2 (or 4) above, select all directories (which will be those containing the files of interest).
. In the menu bar, click on Mark and Save Selection To File.
. Edit the selection file and remove the parent directory path d:\...\A\ for all entries. (This could be done via search and replace or via column block deletion in a program editor. Depending on your editor, you might need to change from Unicode to ASCII, for example while doing Save As from NotePad.)
. View the actual contents of your directory A.
. In the menu bar, click on Mark and Load Selection From File.
In this case, since you can use the method above to select the actual directories of interest, you probably will not need a bat file. If you want to create a bat file, you can use the MakeBat plugin.
DiskDir Extended is accessed via the Pack dialog because the Pack dialog will send a list of the selected files or directories to DiskDir Extended, and not because DiskDir Extended has anything to do with compression.
If the Feed to listbox button is disabled, I wonder if you are using the most recent version of TC. If you accidentally had used DiskDir instead of DiskDir Extended, I think you would not have been able to do the search for directories in my section 3.
Last edited by Ralph on 2014-04-08, 04:27 UTC, edited 1 time in total.
Another methods:
FileInDir 1.1
Plugin can be used to search for directories which contain specified file with specified text content.
http://www.totalcmd.net/plugring/fileindir.html
But it only support TC 32bit, and need to set the fileindir.ini before use search function in TC 32bit.
fileindir.ini example:
FileInDir 1.1
Plugin can be used to search for directories which contain specified file with specified text content.
http://www.totalcmd.net/plugring/fileindir.html
But it only support TC 32bit, and need to set the fileindir.ini before use search function in TC 32bit.
fileindir.ini example:
Code: Select all
[Search01]
IgnoreCase=1
SearchFile=file C
SearchContent=
The more choices, the better.
However, FileInDir doesn't work for me.
I installed the plugin.
Open fileindir.ini and set SearchFile=*.mp4
Alt+F7 open search window
Leave blank in "Search for" and set Attributes to be "Directory"
Check off "Search in plugins"
Choose FileInDir plugin and set value = YES
It took a long time to search and didn't find anything.
Tried a couple of times and TC crashed.
It seems to me this plugin is not very stable yet
However, FileInDir doesn't work for me.
I installed the plugin.
Open fileindir.ini and set SearchFile=*.mp4
Alt+F7 open search window
Leave blank in "Search for" and set Attributes to be "Directory"
Check off "Search in plugins"
Choose FileInDir plugin and set value = YES
It took a long time to search and didn't find anything.

Tried a couple of times and TC crashed.
It seems to me this plugin is not very stable yet