Jump to content
Sign in to follow this  
DigDeep

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

Recommended Posts

DigDeep

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

Share this post


Link to post
Share on other sites
BrewManNH

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

Share this post


Link to post
Share on other sites
DigDeep

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

Share this post


Link to post
Share on other sites
BrewManNH

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

Share this post


Link to post
Share on other sites
DigDeep

There is no result for _FileListToArrayRec. I have checked in the helpfile too but it does not exist.

Share this post


Link to post
Share on other sites
BrewManNH

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

Share this post


Link to post
Share on other sites
DigDeep

I am having latest SCITE version# 3.3.7 installed

AutoIT Version is 3.3.11.3

but _FileListToArrayRec is still not present in the help.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.