Andromo - Start Making Apps - Free Signup

Announcement

Collapse

New Forum Software

If you're here, you've found the new home for our forums. There will be some bugs to iron out, so thanks for your patience...
See more
See less

Search for folders with the same name

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Search for folders with the same name

    Hi guys, was wondering if any of you could me with the code that once i click the button then it will search for folders that has the same folder names in multiple locations and list them all I guess in the list box. There will be 6 folder locations it needs to do the search. Locations will be like below:

    6 Locations to do a search: (search only for folder names not files)

    d:\active
    e:\active
    f:\active
    g:\active
    h:\active
    i:\active

    it will search only will all those folders and no recurse folder so it will be faster since the only thing I need to know is all inside the active folders on all the drives.

    The only function for it is just search for folder names tha has the same name and list them all if there is and show it in a list box.

    Thanks much.

    yhb)

  • #2
    hmmm.... I still believe that one of these days my angel will see my post and help me out.... he he he he..

    yhb)

    Comment


    • #3
      Sorry no one responded earlier...

      See if the following works for you.
      You should be able to replicate it for each drive.
      the command returns a boolean value to determine if the folder exists. (refer to the help document)

      PHP Code:
      does_exist Folder.DoesExist("D:\\Active");
      --
      if 
      does_exist then
          Dialog
      .Message("Notice""Yes, the folder does exist on your system."MB_OKMB_ICONINFORMATION);
      else
          
      Dialog.Message("Notice""No, the folder does not exist on your system."MB_OKMB_ICONINFORMATION);
      end 
      Optionally, text could be displayed in an input box in lieu of the Dialog.Message.

      P.S. : I'm definately no angel. LOL

      hth

      Comment


      • #4
        Yeah, the angel has arrived


        Basically, holtgrewe is absolutely correct. However, to give you less of a hard time, and because you have been specific, (and because im such a nice guy)
        Here you go

        Code:
        tblZ = {}
        tblCount = 0
        --[[1]] does_exist = Folder.DoesExist("d:\\active");
        if does_exist then 
        tblCount = tblCount + 1
        tblZ[tblCount] = ("d:\\active")
        end
        
        --[[2]] does_exist = Folder.DoesExist("e:\\active");
        if does_exist then 
        tblCount = tblCount + 1
        tblZ[tblCount] = ("e:\\active")
        end
        
        --[[3]] does_exist = Folder.DoesExist("f:\\active");
        if does_exist then 
        tblCount = tblCount + 1
        tblZ[tblCount] = ("f:\\active")
        end
        
        --[[4]] does_exist = Folder.DoesExist("g:\\active");
        if does_exist then 
        tblCount = tblCount + 1
        tblZ[tblCount] = ("g:\\active")
        end
        
        --[[5]] does_exist = Folder.DoesExist("h:\\active");
        if does_exist then 
        tblCount = tblCount + 1
        tblZ[tblCount] = ("h:\\active")
        end
        
        --[[6]] does_exist = Folder.DoesExist("i:\\active");
        if does_exist then 
        tblCount = tblCount + 1
        tblZ[tblCount] = ("i:\\active")
        end
        -----
        --[[Show the results in the listbox]] for tbPOS, folder_found in tblZ do
        ListBox.InsertItem("ListBox1", -1, folder_found, "");
        
        end
        --[[This will show if nothing gets listed in ListBox1]] listCOUNT = ListBox.GetCount("ListBox1");
        if listCOUNT == 0 then
        -- none of the folders were found
        end
        I hope you find this helpful.
        Last edited by Mina; 12-15-2007, 01:14 AM.

        Comment


        • #5
          well, to me you are all are.. he he.. thank you both for the reply, appreciate it. I tried both of the code you guys posted and it seems to work but it just listing the folders that was mentioned in the script and not really telling me if there's any folder(s) exist(s) with the same folder name which I know there is .... lol

          I think I still didn't explain it very well but I'm sure this one will clear it up a lot better than the original post I did. I'll try to show you what's inside the " ACTIVE " folders.

          For example the " D:\ACTIVE " folder contains lots of files and sub-folders as well.

          ......................D:\ACTIVE_
          .......................................|
          .......................................|
          .......................................|_11111_
          .......................................|.......... .|_Master
          .......................................|.......... .|_Engineering
          .......................................|.......... .|_Production
          .......................................|.......... .|_MilSpec
          .......................................|.......... .|_ISO
          .......................................|.......... .|_Misc
          .......................................|.......... .|_BackUp
          .......................................|
          .......................................|
          .......................................|_22222
          .......................................|
          .......................................|
          .......................................|_33333
          .......................................|
          .......................................|
          .......................................|_44444<--the blue folder(s) is all I'm concerned not having duplicate folder name(s).....
          .......................................|
          .......................................|
          .......................................|_55555

          Now, the sub-folders under " D:\ACTIVE " that I have colored in BLUE are the ONLY folders I DON'T want any duplicate folder name(s) on other locations like... :lol

          E:\ACTIVE\
          F:\ACTIVE\
          G:\ACTIVE\
          H:\ACTIVE\
          I:\ACTIVE\

          I'm just trying to create something I can execute anytime I needed to run it and can SCAN/SEARCH ALL those " ACTIVE " drive folders I have mentioned and will list the duplicate folder names and their exact locations ( if found one or more) and so I can easily locate and fix all the duplicate folders it finds.

          In short, if it finds one or more duplicates folder names then it list in the listbox the folder name(s) and their locations like:


          FOUND " 2 " DUPLICATE FOLDER NAME(S).......


          D:\ACTIVE\33333
          F:\ACTIVE\33333

          G:\ACTIVE\12345
          H:\ACTIVE\12345

          Hopefully, I didn't confuse you more....LOL Thank you so much guys for the replies and input. I appreciate this a lot.

          yhb)

          Comment


          • #6
            I shall color my code too

            Here, try this.
            (Doesn't check for duplicate folder names though, Ill work on that one later if you need it)

            Code:
            ListBox.DeleteItem("ListBox1", LB_ALLITEMS);
            tblDRV = Drive.Enumerate();
            for pos, drv in tblDRV do
               vF = (drv.."1active") -- i can not use "\active". Workaround:
               vFmid = String.Mid(vF, 1, 2);
               vF = (vFmid.."\\active")
               -------------------------------------------------------------
               does_exist = Folder.DoesExist(vF);
               if does_exist then 
               ListBox.InsertItem("ListBox1", -1, vF, "");
               
               tF = Folder.Find(vF, "*", false, nil);
                 if tF ~= nil then
                   for i, theFolders in tF do
                   ListBox.InsertItem("ListBox1", -1, (theFolders), "");
                   mF = Folder.Find(theFolders, "*", false, nil);
                      if mF ~= nil then
                     for g, moreFolders in mF do
                     ListBox.InsertItem("ListBox1", -1, (moreFolders), "");
                     end
                      end
                    end
            ListBox.DeselectItem("ListBox1", LB_ALLITEMS);
                   end
                 end
              end

            Comment

            Working...
            X