Announcement

Collapse
No announcement yet.

Find File and then Delete Folder

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

  • Find File and then Delete Folder

    Hello.
    i want to create program to find xfile and if found , then delete all folder and all xfile .
    but this code not work.
    anyone can help me please
    PHP Code:

    Address 
    Input.GetText("Input13");
    FileName Input.GetText("Input14");

    my_docs_path Address ;


    if (
    Application.GetLastError() == 0)then



        search_results 
    File.Find(my_docs_path"*promo*.*"truetruenil);
        

        
    error Application.GetLastError();
        if 
    error ~= 0 then
            Dialog
    .Message("Error",_tblErrorMessages[error]);
        else



            if (
    search_results == nilthen
                Dialog
    .Message("Notice""YourFile was not found in your folder.");



            else
                
    message "YourFile was found in the following location(s). Click OK to delete the file(s):\r\n\r\n";
                for 
    indexpath in pairs(search_results) do
                    
    message String.Concat(messagepath.."\r\n");
                
    end
                proceed 
    Dialog.Message("File Search Results"messageMB_OKCANCELMB_ICONQUESTIONMB_DEFBUTTON1);

                if 
    proceed == IDOK then

                        
                        
                          
    for i,v in pairs(search_results) do
                          
                          
                          
    Paths String.SplitPath(search_results[i]);
                          
                          
                          
    File.Delete(Paths.folderfalsefalsefalsenil);
                          
                          

                        if (
    Application.GetLastError() ~= 0then
                            Dialog
    .Message("Error""The file located at: "..i.." could not be deleted.");
                            
                        
    end
                    end
                end
            end
        end 
    Thanx
Working...
X