Jump to content

Search the Community

Showing results for tags 'FileDelete x64'.

  • 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, The following script is meant to delete all files in C:\Users\<username>\AppData\Local\Temp. There are a couple of exceptions and that logic works OK. Unfortunately the FileDelete always returns Status <> 1 (delete failed) and I don't understand why. The OS where the script is running is W7 x64. I mention this because I wonder whether there is something funny going on due to the OS. In the While loop I needed to add a check for a blank file name on the 2nd line of the loop because otherwise the FileFindFirstFile returns a never-ending list of blank entries after all of the real file & directory entries are returned (and I have not seen that behaviour before). As for why the FileDelete does not work, I'm guessing I've done something silly which I keep missing. It is not a NTFS permissions issue nor is it a RunAs issue. ; Obtain list of user directories $search = FileFindFirstFile("C:\Users\*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If $file = "" Then ExitLoop ConsoleWrite("Directory: " & $file & @CRLF) If @error Then ExitLoop If $file = "Default" Then ConsoleWrite("Directory: " & $file & " skipped" & @CRLF) ContinueLoop EndIf If $file = "Default User" Then ConsoleWrite("Directory: " & $file & " skipped" & @CRLF) ContinueLoop EndIf If $file = "All Users" Then ConsoleWrite("Directory: " & $file & " skipped" & @CRLF) ContinueLoop EndIf If $file = "Public" Then ConsoleWrite("Directory: " & $file & " skipped" & @CRLF) ContinueLoop EndIf If Not StringInStr(FileGetAttrib("C:\Users\" & $file),"D") Then ConsoleWrite("File: " & $file & " skipped" & @CRLF) ContinueLoop EndIf ; Process directory If FileExists("C:\Users\" & $file & "\AppData\Local\Temp") Then $Status = FileDelete("C:\Users\" & $file & "\AppData\Local\Temp\*.*") ConsoleWrite("C:\Users\" & $file & "\AppData\Local\Temp\*.*" & @CRLF) If $Status = 1 Then ConsoleWrite("Clean Temp successful : " & $file & @CRLF) Else ConsoleWrite("*** Clean Temp failed *** : " & $file & @CRLF) EndIf Else ConsoleWrite("C:\Users\" & $file & "\AppData\Local\Temp : not found" & @CRLF) EndIf WEnd ; Close the search handle FileClose($search) Appreciate suggestions on how to troubleshoot, or where I have stuffed up. Thanks VW
×
×
  • Create New...