ffdshow Posted October 4, 2007 Share 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 ? Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 4, 2007 Share 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 Link to comment Share on other sites More sharing options...
ffdshow Posted October 4, 2007 Author Share Posted October 4, 2007 Sorry PsaltyDS but I have this error Link to comment Share on other sites More sharing options...
ChrisL Posted October 4, 2007 Share 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 4, 2007 Share 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 Link to comment Share on other sites More sharing options...
ffdshow Posted October 4, 2007 Author Share 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 4, 2007 Moderators Share 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. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 4, 2007 Share 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 4, 2007 Moderators Share 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. Link to comment Share on other sites More sharing options...
ffdshow Posted October 4, 2007 Author Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now