Find directories containing certain file

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Find directories containing certain file

Post by *tbeu »

I need to search a directory tree recursively for all directories containing a certain file, pass the found directories to the list box and then "pack" using TreeCopyPlus (packer plugin) to copy all these found directories (with all containing files and directory structure considered).

However, there is no simple workflow/solution/plugin to find these directories. Currently, I use the DirSizeCalc content plugin to search for a certain file count, since I know the number if the file to search for exists (and that it is a different number if the file does not exist) and that the file only exists on leaf directories. Is there any better/direct solution?

Sorry, if duplicated issue, but I actually searched the forum and found no acceptable solution so far.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Find directories containing certain file

Post by *MVV »

Perhaps you could try FileInDir plugin...
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Re: Find directories containing certain file

Post by *tbeu »

Thanks. Indeed, that is the kind of plugin I was thinking of. Was not yet aware of the FileInDir content plugin. Let me see if I can make a proper 64-bit version of it.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Re: Find directories containing certain file

Post by *tbeu »

tbeu wrote: 2018-12-21, 14:05 UTC Let me see if I can make a proper 64-bit version of it.
Done. FileInDir 2.0.0.1 is released at totalcmd.net.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
versalzen
Power Member
Power Member
Posts: 666
Joined: 2003-09-16, 11:52 UTC
Location: kölle, linksrheinisch.

Re: Find directories containing certain file

Post by *versalzen »

Thanks tbeu!

Very much appreceated.

It is possible to store some simple searches in the fileindir.ini file.
Like:
[has_mp3s]
IgnoreCase=1
SearchFile=*.mp3

Is it possible too, to store a more complex search, like this Image: https://imgur.com/HrqDWxe?

If yes, I don't find the syntax in the readme.

I mean, in the fileindir.ini file, not in TC's search, where we surely can store that serach.

I know, you're not the initial dev, but maybe you know it by reading the code :-)

Thanks!
Was nützt der Löffel für die Weisheit, wenn man zu weit vom Suppentopf entfernt sitzt?

Mario
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Re: Find directories containing certain file

Post by *tbeu »

versalzen wrote: 2020-10-11, 11:14 UTC It is possible to store some simple searches in the fileindir.ini file.
Like:
[has_mp3s]
Yes, can do.
versalzen wrote: 2020-10-11, 11:14 UTC Is it possible too, to store a more complex search, like this Image: https://imgur.com/HrqDWxe?
No, this it not possible since the current plugin implementation relies on FindFirstFile, which can take wildcard characters as question mark or asterisk, but no regular expressions.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
vdijken
Member
Member
Posts: 181
Joined: 2016-07-30, 14:07 UTC
Location: The Netherlands

Re: Find directories containing certain file

Post by *vdijken »

Very simple:
1) search for the file (ALT+F7)
2) put the resulting list in one of the panels
3) select in the other panel the directory where the zip file should be
4)select all the files and use the key ALT+F5
5)Give the zip file a name and the files are copied complete with the structure.
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Re: Find directories containing certain file

Post by *solid »

Hi @tbeu

What is the scope of DirSubdirs property? Does it only search if folders contains subfolder? Is it possible to check for deeper level?
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Re: Find directories containing certain file

Post by *tbeu »

@solid No it is not a recursive search, just for direct subdirectories.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
Post Reply