topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 1:03 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Search Subdirs for Missing File  (Read 6266 times)

edbro

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 426
    • View Profile
    • Donate to Member
DONE: Search Subdirs for Missing File
« on: January 18, 2010, 07:28 PM »
I need the capability to search a directory that has a lot of subdirectories and find those subdirs that are missing a certain file. I'd like to be able to run a search and be able to see which folders are missing a filename that I can supply as an argument.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: DONE: Search Subdirs for Missing File
« Reply #1 on: January 18, 2010, 09:43 PM »
try this AHK code...

you will be prompted for a starting directory and a filter file

script will search through and display a list of offending folders in a small gui (list)

note that I have assumed that each folder should be considered in isolation, ie a folder that doesn't contain the selected file but does contain a subfolder containing it is still considered to NOT contain the file  

nothing fancy, but it should get you started


loop, parse, a_loopfilefullpath
{
    if a_loopfield = \
        L1++
}   

loop, %source%\*.*, 2, 1
{
    error = 0
    loop, %a_loopfilefullpath%\%myVAR%, 0, 0
    {
            error:= 1
            Break
    }
    if error = 0
        mylist.= a_loopfilefullpath . "`n"
}

sort, mylist, CL U

menu, print, add, Print
menu, ToFile, add, To_File
;menu, ToHTML, add, To_HTML
menu, menubar, add, print
menu, menubar, add, To_File
;menu, menubar, add, To_HTML
gui, menu, menubar
gui, add, listview, r20 w750 grid nosort gClickMe, Folder
loop, parse, mylist, `n
{
    lv_ADD("",a_loopfield)
}
gui, add, statusbar,, source folder - %source%
gui, show
return

guiescape:
guiclose:
exitapp

print:
fileappend, %mylist%, c:\temp\Tmp.txt
runwait, print c:\temp\Tmp.txt,,hide
filedelete, c:\temp\Tmp.txt
return

to_file:
filedelete, %source%\ex-files.txt
fileappend, %mylist%, %source%\ex-files.txt
return

ClickMe:
if a_guievent = DoubleClick
{
    lv_GetText(myFolder,A_eventinfo)
    run %myfolder%
}
return

#r::reload

EDIT: updated source
« Last Edit: January 21, 2010, 08:32 PM by Target »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Search Subdirs for Missing File
« Reply #2 on: January 18, 2010, 10:47 PM »
Here's my take (source/binary included): Download

2010-01-18_224513.pngDONE: Search Subdirs for Missing File

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: DONE: Search Subdirs for Missing File
« Reply #3 on: January 19, 2010, 12:25 AM »
a small improvement - added the functionality to print the list, or export it to a file

EDIT: redundant attachments removed
« Last Edit: January 21, 2010, 08:33 PM by Target »

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: DONE: Search Subdirs for Missing File
« Reply #4 on: January 19, 2010, 07:27 PM »
a further change - double click an entry in the list to open that folder in exploder

« Last Edit: January 21, 2010, 08:34 PM by Target »