Jump to content

Search for a specific file or folder and delete it...


DigDeep
 Share

Recommended Posts

Hi,

 

I am new to this forum. I am preparing a code and would need urgent help please.

 

Basically the code should

1. scan the complete directory (C:) to look for a specific folder / file name (TESTER).

2. save the results with the location paths in a text file.

3. Delete all the files and folders in those locations.

 

 

I have prepared the code but unfortunately it doesn't work.

 

 

#Include <Array.au3>

#include <Constants.au3>

#include <IE.au3>

#include <ClipBoard.au3>

#include <File.au3>

 

 

 

;~ Scan for TESTER existance

$sST = Run(@ComSpec & " /c " & "dir tester*.* /s", "C:", @SW_HIDE, $STDOUT_CHILD+$STDERR_CHILD)

Local $ResponseText

While 1

    $ResponseText &= StdoutRead($sST)

    If @error Then ExitLoop

Wend

If  $ResponseText = True Then

MsgBox(16, "Warning", "Unknow Program activity found on your PC. Click OK to clean.")

RunWait(@ComSpec & " /c " & "del tester*.* /s", "C:", @SW_HIDE)

EndIf

Link to comment
Share on other sites

FileListToArrayRec, _FileWriteFromArray, FileDelete, those should get you started.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I tried with _FileListToArray but it is not working.

The thing I need is..I do not know how many locations / paths the folder or file is saved with the name "Tester".

So, I want 1st to display all the directory and files with the complete path and then delete all of them.

eg: if the file is saved in all these locations how can I search both Files and folders by giving the wildcard tester*.*?

c:UsersusernameAppDataLocalMicrosoftInternet ExplorerDOMStoreDUQD8HGVen.tester[1].xml

c:UsersusernameAppDataLocalMicrosoftInternet ExplorerDOMStoreKSB5GQC5vlc-media-player.en.tester[1].xml

c:UsersusernameAppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE54ZVZAXYLen_tester_com[1].htm

c:UsersusernameAppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE54ZVZAXYLlogo_tester_follow_download[1].png

c:UsersusernameAppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE57HTA1AT0vlc-media-player_en_tester_com[1].htm

c:UsersusernameAppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE5B43J6AHU30603;728568;201;pixel;tester;testerTargetedTxtLogoSmartAds[1].htm

c:UsersusernameAppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE5B43J6AHU30603;730675;201;redirect;tester;testerTargetedTxtLogoSmartAdsAnalyzeThat[1].htm

c:UsersusernameAppDataLocalTechSmithSnagitDataStoreWebSiteIconsvlc-media-player.en.tester.com.ico

c:UsersusernameDownloadsProgramstester.exe

C:UsersusernameAppDataRoamingIDMDwnlDatausernametester

Can you please write the code?

Edited by sunshinesmile84
Link to comment
Share on other sites

I tried with _FileListToArray but it is not working.

I said _FileListToArrayRec, actually I forgot the initial underscore but it still would have been found in the help file without it.

Can you please write the code?

No.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Yes it does, you have the wrong version of AutoIt, update and you will find it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...