Jump to content

Search the Community

Showing results for tags 'temp files'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello Friends, Please assist me with the script below. ScitTE SyntaxCheckProd finds no errors. However, I cannot make it find or delete any files. I am running Autoit 3.3.14.5 on Windows 10 Home X64. I have searched the forums and internet for days and can't find anything superior to my present script. My goal is to: 1. Delete folders and files recursively older than 15 days. 2. No GUI needed. 3. Do not force deletion and no confirmation needed. 4. Don't want to use forfiles. Autoit Script: #RequireAdmin #include <Date.au3> #include <File.au3> const $MAXAGE = 3 ; days global $msg = "" global $nFilesDel = 0 $retval = _FileDeleteRecursive("C:\test","*.*",$MAXAGE) func _FileDeleteRecursive($sPath, $pattern, $maxage) local $files = _FileListToArray($sPath,$pattern,1) if @error <> 0 then return -1 local $dirs = _FileListToArray($sPath,"*",2) if @error <> 0 then return -1 local $age, $nFilesFound = 0, $retval if IsArray($files) then for $n = 1 to $files[0] $age = _DateDiffInDays($sPath & "\" & $files[$n]) if $age > $maxage then _DeleteFile($sPath & "\" & $files[$n],$age) $nFilesFound += 1 endif next endif if IsArray($dirs) then for $n = 1 to $dirs[0] $retval = _FileDeleteRecursive($sPath & "\" & $dirs[$n], $pattern,$maxage) if $retval > 0 then $nFilesFound += $retval next endif return $nFilesFound endfunc func _DateDiffInDays($filename) if not FileExists($filename) then return -1 local $filetime = FileGetTime($filename) local $tempDate = $filetime[0] & "/" & $filetime[1] & "/" & $filetime[2] local $currDate = @YEAR & "/" & @MON & "/" & @MDAY return _DateDiff("D",$tempDate,$currDate) endfunc func _DeleteFile($filepath,$age) $msg = $msg & "Age: " & $age & " File: " & $filepath & @CRLF FileDelete($filepath) $nFilesDel += 1 endfunc
×
×
  • Create New...