caocao81 Posted October 17, 2007 Posted October 17, 2007 1. I want to get the edit time of the dirctory, if the time is 7 days ago, I need to del it, so I need to get the time, but in autoit help files, I found only a function for file "FileGetTime", how to get the edit time of the dirctory? 2. I need to del all the file in a dirctory, the dirctory have a lot of subdirctory, subdrictory also have a lot of file in it. how to del all?
caocao81 Posted October 17, 2007 Author Posted October 17, 2007 2. DirRemove()for example: I want to del all the file and subdirctoy in dirctory E:\temp, but if use DirRemove("E:\temp\",1) , it will del the E:\temp also, but this dirctory not need to del.Thank U for your reply!
caocao81 Posted October 17, 2007 Author Posted October 17, 2007 DirRemove(), DirCreate()...any other method?
rasim Posted October 17, 2007 Posted October 17, 2007 $folder = "c:\test" FileOpen($folder, 0) DirRemove($folder, 1) FileClose($folder)
BrettF Posted October 17, 2007 Posted October 17, 2007 Would something like suffice? #include <Array.au3> #Include <Date.au3> $dir = FileSelectFolder ("Select Folder", "") $data = "" $time = FileGetTime ($dir) $time = $time[0] & "/" & $time[1] & "/" & $time[2] $current = _NowCalcDate ( ); YYYY/MM/DD If _DateDiff ("D", $time, $current) >= 7 Then DirRemove ($dir, 1) DirCreate ($dir) $data = "DIRECTORY ("&$DIR&") REMOVED. DIRECTORY RE-CREATED" & @CRLF Else $data = "DIRECTORY ("&$DIR&") NOT OLD ENOUGH TO BE REMOVED" & @CRLF & EndIf ConsoleWrite ($data) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
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