Search for Folders which contain specific file

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Search for Folders which contain specific file

Post by karimmaster101 »

I want to search folders which contain "readme.txt", I want that search results page show me "Folders" not readme.txt files
thanks in advance

admin
Site Admin
Posts: 67229
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Search for Folders which contain specific file

Post by admin »

Copy Containing Folders can be used for this. See http://www.xyplorer.com/release_11.60.htm#v0200

karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Re: Search for Folders which contain specific file

Post by karimmaster101 »

admin wrote:Copy Containing Folders can be used for this. See http://www.xyplorer.com/release_11.60.htm#v0200
Thanks for your fast reply, But I don't want to copy folders, I want to list them so I can add labels or comments or batch rename them.
I think that this issue will be solved with a script. which list multiple paths like this
D:\movies\AB
D:\movies\AD
D:\movies\CC
But I don't know how I can do this

totmad1
Posts: 131
Joined: 24 Jun 2013 12:37

Re: Search for Folders which contain specific file

Post by totmad1 »

This script will, once you have selected all that you want after your search,
collect the names,write paths to temp.xys and write comment "ReadMe" to each folder.
You can of course then load from this script to visit any of those single folders,
or just delete temp.xys

Code: Select all

"1 Collect items : collect"
        $SelectedItemsPath= getinfo ("SelectedItemsPathNames", "|")."|";
        $CountSelectedItems= getinfo ("CountSelected");
         set $Items, $SelectedItemsPath;
         incr $Count, $Count, $CountSelectedItems;
                $T="";
               $i = 1;
                  while ($i <  $Count+1) {
                  $file=gettoken($SelectedItemsPath,$i,"|");
                    $q = getpathcomponent( "$file", "path");
                    $p = getpathcomponent( "$file", "file");
                     $file=$q . <crlf>;
                     $A= strpos("$file", "\", -1);
                    $Zfile = substr("$file", 0, $A);
                     $b = "ReadMe";                     // you can change comment here
                     tag "$b",$q , 2;
                    $Tfile = "; sel""[$q]"", ,1" ;
                   writefile("<xyscripts>\temp.xys", "No.$i $p" goto "$Zfile"$Tfile<crlf>,"a");
                   $i++;
                }  

"2.load "   load "<xyscripts>\temp.xys";
"3.Delete temp.xys"   delete 0, 0, "<xyscripts>\temp.xys";
hope this at least helps
totmad1 (totally mad one)

Post Reply