Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: finding folders *without* specified files (Read 3277 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

finding folders *without* specified files

hello,

i need a way to find folders under given path that do not contain specified files, like *.nfo, *.xml.tags (my custom format) etc.

it would be best if the results could have been drag'n'dropped. also special features like 'consider only bottom-level folders', 'consider only non-empty folders' etc. would be nice ...

util or some sort of script would do ... for win32

finding folders *without* specified files

Reply #1
I guess it could be done with regular expressions, Total Commander can search with them.

finding folders *without* specified files

Reply #2
Quote
i need a way to find folders under given path that do not contain specified files, like *.nfo, *.xml.tags (my custom format) etc.[a href="index.php?act=findpost&pid=292114"][{POST_SNAPBACK}][/a]

A)Not exactly what you're looking for, but Treesize Professional (http://www.jam-software.com/treesize/, Shareware) is a diskspace manager with an extension filter feature: you can filter on one extension so the reports (incl. nb of files) you will see, will be only for the extension you selected.

B)In a script, eg:
dir *.htm? *.txt /s | grep R.pertoire
This will give you a list of folders (absolute paths) containing at least one file matching *.htm? or *.txt
1) change "R.pertoire" with something like "folder" if you're using a US version
2) grep for Windows is part of GNU Utils (http://unxutils.sourceforge.net/)

I don't know about extracting the list of bottom-level folders, sorry. 
Best audio player for the power user: foobar2000

finding folders *without* specified files

Reply #3
ok ... here you have it ... very basic ... Not Here 0.1 ....

C:\DEV\nothere>nothere . file_id.diz
NotHere 0.1 by Kwanbis - Developed in Borland Delphi.
Parameters: C:\DEV\nothere\nothere.exe.file_id.diz

NOT Found file_id.diz in <C:\DEV\nothere>
NOT Found file_id.diz in <C:\DEV\nothere\a>
NOT Found file_id.diz in <C:\DEV\nothere\a\a1>
NOT Found file_id.diz in <C:\DEV\nothere\a\a2>
NOT Found file_id.diz in <C:\DEV\nothere\b>
NOT Found file_id.diz in <C:\DEV\nothere\b\b1>
NOT Found file_id.diz in <C:\DEV\nothere\c>
NOT Found file_id.diz in <C:\DEV\nothere\c\c1>
NOT Found file_id.diz in <C:\DEV\nothere\c\c2>
NOT Found file_id.diz in <C:\DEV\nothere\c\c2\c2a>
NOT Found file_id.diz in <C:\DEV\nothere\c\c2\c2b>
NOT Found file_id.diz in <C:\DEV\nothere\c\c2\c2c>
NOT Found file_id.diz in <C:\DEV\nothere\c\c3>
DONE. Press <ENTER> to finish.

 

finding folders *without* specified files

Reply #4
thanks for your help, guys!

kwanbis, that's very nice that you made that ... i would like to see some advanced features:

1) filemasks (i.e. *.xml, *.nfo)
2) switch to limit reporting only to
  a) non-empty folders (i.e. without files but possibly with subfolders)
  b) folders with specified types of files (it should support multiple masks)
3) that's difficult one - i need to get resulting list as imput to other app (in this case foobar), so i would need it to support drag'n'drop (which i'm not sure is possible in console app). also param to make the output 'clear' (only list of dirs, without any additional info / formatting) could help ...

i would use option 2) this way: *.mp3,*.flac,*.ogg ... so i could find folders with music files, which do not contain in my case *.tag.xml file ...

could you share your sources? i've done some delphi coding in the past and would like to try again

finding folders *without* specified files

Reply #5
Quote
could you share your sources? i've done some delphi coding in the past and would like to try again

it was a really quick hack  ... here are the sources ... unde the GPL license:

Code: [Select]
// NotHere - Copyright Kwanbis - License GPL
program nothere;


{$APPTYPE CONSOLE}

uses
 SysUtils;

Procedure Directorio(StartDir: AnsiString; Archivo: AnsiString);
var DirInfo: TSearchRec; r: Integer; found: boolean;
begin
//  Writeln('Processing Directory: <' + StartDir + '>');
 found := false;
 SetCurrentDir(StartDir);
 r := FindFirst(StartDir + '\*.*', FaDirectory, DirInfo);
 while r = 0 do  begin
   if UpperCase(DirInfo.Name) = UpperCase(archivo) then Found := True;
   r := FindNext(DirInfo);
 end;
 if Not Found then Writeln('NOT Found ' + archivo + ' in <' + StartDir + '>');
 r := FindFirst(StartDir + '\*.*', FaDirectory, DirInfo);
 while r = 0 do  begin
   if (DirInfo.Attr and FaDirectory = FaDirectory) and (DirInfo.Name <> '.') and (DirInfo.Name <> '..') then
     Directorio(StartDir+'\'+DirInfo.Name, Archivo);
   r := FindNext(DirInfo);
 end;
 SysUtils.FindClose(DirInfo);
end;

var i: integer;

begin
 WriteLn('NotHere 0.1 by Kwanbis - Developed in Borland Delphi.');
 if ParamCount < 2 then begin
   WriteLn('Syntaxis: nothere fullpath filename');
   Halt(1);
 end;
 Write('Parameters: ');
 for i := 0 to ParamCount do Write(ParamStr(i));
 WriteLn;
 WriteLn;
 Directorio(ExcludeTrailingPathDelimiter(ExpandFileName(ParamStr(1))), ParamStr(2));
 WriteLn('DONE. Press <ENTER> to finish.');
 ReadLn;
end.

finding folders *without* specified files

Reply #6
hello ...

i made a small gui util for doing all that stuff i need. it supports drag'n'drop so you can drop folders to process with it and then drag results for example to foobar.

it's rather slow atm, not-threated and you can't stop it while in progress. you can specify multiple folders to process, multiple folder names to skip (w/ wildcards), multiple 'missing' files (w/ wildcards), multiple 'including' files (w/ wildcards) and filter (return all results / only top-level or bottom-level).

folder, to get onto results' list, among other things needs to have no matching file from 'missing' list and at least one from 'including' list. you can set 'including' list to blank and disable that feature. setting it to '*' would make it return only non-empty folders (for that, only files count, not subfolders).

link