Indigo Rose Software
  #1  
Old 11-26-2007
yhb's Avatar
yhb yhb is offline
Forum Member
 
Join Date: Sep 2007
Posts: 47
Smile 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)
Reply With Quote
  #2  
Old 12-14-2007
yhb's Avatar
yhb yhb is offline
Forum Member
 
Join Date: Sep 2007
Posts: 47
Talking

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

yhb)
Reply With Quote
  #3  
Old 12-15-2007
holtgrewe holtgrewe is offline
Indigo Rose Customer
 
Join Date: Jul 2002
Location: Just South of Reality
Posts: 732
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
Reply With Quote
  #4  
Old 12-15-2007
Mina's Avatar
Mina Mina is offline
Forum Member
 
Join Date: Oct 2005
Location: American Dubai
Posts: 629
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 at 01:14 AM.
Reply With Quote
  #5  
Old 12-15-2007
yhb's Avatar
yhb yhb is offline
Forum Member
 
Join Date: Sep 2007
Posts: 47
Talking

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...

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)
Reply With Quote
  #6  
Old 12-16-2007
Mina's Avatar
Mina Mina is offline
Forum Member
 
Join Date: Oct 2005
Location: American Dubai
Posts: 629
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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listing search results in a listbox? bobbie AutoPlay Media Studio 6.0 17 03-22-2006 04:03 PM
SQLITE Search on CD perry_d76 AutoPlay Media Studio 5.0 4 03-31-2004 09:36 PM
Cancelling File Search pjborg AutoPlay Media Studio 4.0 3 06-23-2003 02:49 AM
File Search Jan Fr. Nordbakke Setup Factory 5.0 0 10-14-2001 04:50 AM
Can search allow manual browse even if file is found? RichardShaw Setup Factory 5.0 2 08-28-2000 07:08 PM


All times are GMT -6. The time now is 04:16 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software