ffdshow 0 Posted October 4, 2007 Hi! I tried to remove Directory which is in a folder named stv23a.tmp or stv55t.tmp or... This command don't workDirRemove(@TempDir & "\stv~1.tmp\Directory\", 1) Is correct stv~1.tmp ? Share this post Link to post Share on other sites
PsaltyDS 41 Posted October 4, 2007 Hi! I tried to remove Directory which is in a folder named stv23a.tmp or stv55t.tmp or... This command don't workDirRemove(@TempDir & "\stv~1.tmp\Directory\", 1) Is correct stv~1.tmp ? The wildcard would be "stv*.tmp", but DirRemove() doesn't accept wildcards. Use _FileListToArray() with the flag for directories only, then loop through the array to do the deletes one at a time. $avDirList = _FileListToArray(@TempDir & "\stv*.tmp", 2) If IsArray($avDirList) Then For $n = 1 To $avDirList[0] $sPath = @TempDir & "\" & $avDirList[$n] & "\Directory" If FileExists($sPath & "\") Then If DirRemove($sPath, 1) Then ConsoleWrite("Debug: Successfully deleted directory: " & $sPath & @LF) Else ConsoleWrite("Debug: Failed to delete directory: " & $sPath & @LF) EndIf Else ConsoleWrite("Debug: Directory does not exist: " & $sPath & @LF) EndIf Next EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
ffdshow 0 Posted October 4, 2007 Sorry PsaltyDS but I have this error Share this post Link to post Share on other sites
ChrisL 13 Posted October 4, 2007 Put #include <File.au3> at the top of your script [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Share this post Link to post Share on other sites
PsaltyDS 41 Posted October 4, 2007 (edited) Sorry PsaltyDS but I have this errorA few years of therapy should straighten you out... ...Oh! There was supposed to be a picture there?! I doesn't render for me. What's the error? Since I don't have your directory tree, I didn't test. So there's no telling how badly I coded that... Ahh. ChrisL has my back... thanks! Edited October 4, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
ffdshow 0 Posted October 4, 2007 Still don't works. Now the script is#include <File.au3> $avDirList = _FileListToArray(@TempDir & "\stv*.tmp", 2) If IsArray($avDirList) Then For $n = 1 To $avDirList[0] $sPath = @TempDir & "\" & $avDirList[$n] & "\Directory" If FileExists($sPath & "\") Then If DirRemove($sPath, 1) Then ConsoleWrite("Debug: Successfully deleted directory: " & $sPath & @LF) Else ConsoleWrite("Debug: Failed to delete directory: " & $sPath & @LF) EndIf Else ConsoleWrite("Debug: Directory does not exist: " & $sPath & @LF) EndIf Next EndIf With no errors, but the Directory folder is not remove. This is the tree: C:\Documents and Settings\Administrator\Local Settings\Temp\stv44r.tmp\Directory Share this post Link to post Share on other sites
SmOke_N 211 Posted October 4, 2007 (edited) Still don't works. Now the script is#include <File.au3> $avDirList = _FileListToArray(@TempDir & "\stv*.tmp", 2) If IsArray($avDirList) Then For $n = 1 To $avDirList[0] $sPath = @TempDir & "\" & $avDirList[$n] & "\Directory" If FileExists($sPath & "\") Then If DirRemove($sPath, 1) Then ConsoleWrite("Debug: Successfully deleted directory: " & $sPath & @LF) Else ConsoleWrite("Debug: Failed to delete directory: " & $sPath & @LF) EndIf Else ConsoleWrite("Debug: Directory does not exist: " & $sPath & @LF) EndIf Next EndIfoÝ÷ ØÆ²më!¢é]mæ®¶seôfÆTÆ7EFô'&FV×F"ÂgV÷C·7Gb¢çF×gV÷C²Â"? Edited October 4, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Share this post Link to post Share on other sites
PsaltyDS 41 Posted October 4, 2007 (edited) Still don't works.With no errors, but the Directory folder is not remove.This is the tree: C:\Documents and Settings\Administrator\Local Settings\Temp\stv44r.tmp\DirectoryDoes @TempDir = "C:\Documents and Settings\Administrator\Local Settings\Temp"? @SmOke_N: Doh! Edited October 4, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
SmOke_N 211 Posted October 4, 2007 (edited) Does @TempDir = "C:\Documents and Settings\Administrator\Local Settings\Temp"? Check out my edit PDS. EDIT: I'll just add it here what I think might work:#include <File.au3> ;#include <array.au3> $avDirList = _FileListToArray(@TempDir, "stv*.tmp", 2) ;_ArrayDisplay($avDirList) If IsArray($avDirList) Then For $n = 1 To $avDirList[0] $sPath = @TempDir & "\" & $avDirList[$n] If FileExists($sPath & "\") Then If DirRemove($sPath, 1) Then ConsoleWrite("Debug: Successfully deleted directory: " & $sPath & @LF) Else ConsoleWrite("Debug: Failed to delete directory: " & $sPath & @LF) EndIf Else ConsoleWrite("Debug: Directory does not exist: " & $sPath & @LF) EndIf Next EndIfI wasn't quite sure what the extra "\Directory" being added on was. Edited October 4, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Share this post Link to post Share on other sites
ffdshow 0 Posted October 4, 2007 (edited) This is the tree: C:\Documents and Settings\Administrator\Local Settings\Temp\stv44r.tmp\Directory\ and with this script it works:#include <File.au3> ;#include <array.au3> $avDirList = _FileListToArray(@TempDir, "stv*.tmp", 2) ;_ArrayDisplay($avDirList) If IsArray($avDirList) Then For $n = 1 To $avDirList[0] $sPath = @TempDir & "\" & $avDirList[$n] & "\Directory" If FileExists($sPath & "\") Then If DirRemove($sPath, 1) Then ConsoleWrite("Debug: Successfully deleted directory: " & $sPath & @LF) Else ConsoleWrite("Debug: Failed to delete directory: " & $sPath & @LF) EndIf Else ConsoleWrite("Debug: Directory does not exist: " & $sPath & @LF) EndIf Next EndIf Thank you guys! Edited October 4, 2007 by ffdshow Share this post Link to post Share on other sites