Add folders to the list

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • bobbie
    Forum Member
    • Feb 2005
    • 770

    Add folders to the list

    I would like to add some more folders to search for but not sure how or where to add them ?
    Or maybe read from a txt file with the list of folders I want to search for ?
    Code:
    -- Set the callback function (used by action Folder.Find)
    function FindCallBack(CurrentFolder)
        -- Show the cancel button
        StatusDlg.ShowCancelButton(true, "Cancel");
        -- Set the status dialog title, message, and status text
        StatusDlg.SetTitle("Searching . . . ");
        StatusDlg.SetMessage("Please wait.     Search is in progress.");
        StatusDlg.SetStatusText("Current Folder: " .. CurrentFolder);
        -- Check if the user pressed cancel
        cancel = StatusDlg.IsCancelled();
        if cancel then
        -- Cancel was pressed, stop the current operation
            return false;
        else
        -- Cancel was not pressed, continue
            return true;
        end
    end
    
    
    
    
    -- Set the drive to search
    drive = "c:\\";
    -- Set the folder to search for
    folder = "1 Click Spy Clean";
    -- Search the specified drive for folders named "windows"
    -- Display the status dialog
    StatusDlg.Show(0, false);
    search_results = Folder.Find(drive, folder, true, FindCallBack);
    --Check to see if an error occurred during the search. If it did, display the error message.
    error = Application.GetLastError();
    StatusDlg.Hide();
    if error ~= 0 then
        Dialog.Message("Error",_tblErrorMessages[error]);
    else
        -- If no directories were found, inform the user
        if (search_results == nil) then
            Dialog.Message("Notice", "There are no folders named '" .. folder .. "' on drive '" .. drive .. "'.");
        -- If folders were found, display a dialog containing a list of their locations.
        else
            message = "A folder named '" .. folder .. "' was found at the following location(s):\r\n\r\n";
            for index, path in search_results do
                message = String.Concat(message, path.."\r\n");
            end
            Dialog.Message("File Search Results", message, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        end
    end
  • bobbie
    Forum Member
    • Feb 2005
    • 770

    #2
    Anyone help me with this ? Like to get this working today if I could before I go to Moms house to work on her computer .

    Comment

    • bobbie
      Forum Member
      • Feb 2005
      • 770

      #3
      I have a long list (200+) of folders I want to see if they are on the drive so how can I draw from a txt file the names I want to search for ?

      Comment

      • Worm
        Indigo Rose Customer
        • Jul 2002
        • 3967

        #4
        Use:

        tbllFoders = TextFile.ReadToTable("\\AutoPlay\\Docs\\FolderList .txt)

        to read the list into the table, then use a for loop to walk the table performing whatever action you want on the folder.
        Last edited by Worm; 06-26-2005, 06:24 PM.

        Comment

        • bobbie
          Forum Member
          • Feb 2005
          • 770

          #5
          Originally posted by Worm
          User

          tbllFoders = TextFile.ReadToTable("\\AutoPlay\Docs\\FolderList. txt)tbllFoders = TextFile.ReadToTable("\\AutoPlay\Docs\\FolderList. txt)

          to read the list into the table, then use a for loop to walk the table performing whatever action you want on the folder.
          Is this spelled right ?
          tbllFoders
          Thank you for the help

          I get this error ?
          Syntax Error: [Location="Page1:Button1", Event "On Click", Line=26]
          Error Detail: [`)' expected near `\'] in [tbllFoders = TextFile.ReadToTable("\\AutoPlay\Docs\\database.tx t)tbllFoders = TextFile.ReadToTable("\\AutoPlay\Docs\\database.tx t)]
          Last edited by bobbie; 06-26-2005, 06:21 PM.

          Comment

          • Worm
            Indigo Rose Customer
            • Jul 2002
            • 3967

            #6
            No, its not, but it's only a variable that holds the table. So even though I'm not a great typist, as long as I keep making the same mistakes, I'm golden :yes

            Originally posted by bobbie
            Is this spelled right ?
            tbllFoders
            Thank you for the help

            Comment

            • Worm
              Indigo Rose Customer
              • Jul 2002
              • 3967

              #7
              I missed a \ in the code, see the edited code above.

              Comment

              • bobbie
                Forum Member
                • Feb 2005
                • 770

                #8
                I seem to be lost as you didn't add the whole line ? could you add the whole line what it looks like right .
                Thank you for the help .

                Comment

                • Worm
                  Indigo Rose Customer
                  • Jul 2002
                  • 3967

                  #9
                  Try this:
                  Code:
                  tblFolders = TextFile.ReadToTable("Autoplay\\Docs\\FolderList.txt")
                  for index, folder in tblFolders do
                  	if folder ~= "" then
                  		Dialog.Message("",folder)
                  	end
                  end

                  Comment

                  • bobbie
                    Forum Member
                    • Feb 2005
                    • 770

                    #10
                    Originally posted by Worm
                    Try this:
                    Code:
                    tblFolders = TextFile.ReadToTable("Autoplay\\Docs\\FolderList.txt")
                    for index, folder in tblFolders do
                    	if folder ~= "" then
                    		Dialog.Message("",folder)
                    	end
                    end
                    It is just reading the txt file now ?
                    I wanted it to use that to do it's search with so to know what folders to look for .

                    Comment

                    • Worm
                      Indigo Rose Customer
                      • Jul 2002
                      • 3967

                      #11
                      Originally posted by bobbie
                      It is just reading the txt file now ?
                      I wanted it to use that to do it's search with so to know what folders to look for .
                      Right, inside the for loop, use the variable folder to do your searches on, I used the dialog merely to show you that "folder" held the contents of the text file line by line.

                      Comment

                      • bobbie
                        Forum Member
                        • Feb 2005
                        • 770

                        #12
                        I'm sorry for being so dumb but I think you lost me .,.

                        Comment

                        • Worm
                          Indigo Rose Customer
                          • Jul 2002
                          • 3967

                          #13
                          Are you searching for a specific folder name, or do you know the paths? The more info you give, the better I can help.

                          Comment

                          • bobbie
                            Forum Member
                            • Feb 2005
                            • 770

                            #14
                            I have a list say that has folders names in it .
                            So I want to search the hard drive and see if any of those folder names are in the hard drive that are on that list of mine and uses the list as a referral .
                            I'm searching for folders of spyware program folders . There are like 200 out there that are fake and don't do anything but get you to buy there program so I want to have something that if I go to frinds I can search their drive to see if any of those are on it .
                            Just would make it easy . .
                            I would be just searching the c drive .
                            Last edited by bobbie; 06-26-2005, 08:24 PM.

                            Comment

                            • Worm
                              Indigo Rose Customer
                              • Jul 2002
                              • 3967

                              #15
                              Okay, let me ask this a different way.

                              To search the hard drive for 200 different folders would take quite a bit of time. For the folder you want to look for, are they *always* in a specific location? (i.e. System Folder, Program Files, etc..)

                              If not, it might be faster to read all the folders into a table, then cycle throught that table looking for the folders you want.

                              Comment

                              Working...
                              X