Jump to content

To delete a temporary folder inside a system folder


Recommended Posts

  • Developers

@gooddew, Please do not report your posts when they are in MOD-PREVIEW, we will get to it when around and are notified automatically.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

hasta la vista

#RequireAdmin
#AutoIt3Wrapper_UseX64=y

#include <FileConstants.au3>
#include <File.au3>


_DelAllFile()

Func _DelAllFile()
    Local $dir = @WindowsDir & "\System32\config\systemprofile\AppData\Local\"
    Local $ArraySrtfiles = _FileListToArrayRec($dir, "tw-*.tmp", $FLTAR_FOLDERS)
    If Not IsArray($ArraySrtfiles) Then
        ConsoleWrite($dir & " = Invalid input path" & @CRLF)
        Return
    Else
        For $x = 1 To $ArraySrtfiles[0]
            ConsoleWrite($x & ") " & $dir & $ArraySrtfiles[$x] & " DirRemove=" & DirRemove($dir & $ArraySrtfiles[$x], 1) & @CRLF)
        Next
    EndIf
EndFunc   ;==>_DelAllFile

 

I know that I know nothing

Link to comment
Share on other sites

7 hours ago, ioa747 said:

hasta la vista

#RequireAdmin
#AutoIt3Wrapper_UseX64=y

#include <FileConstants.au3>
#include <File.au3>


_DelAllFile()

Func _DelAllFile()
    Local $dir = @WindowsDir & "\System32\config\systemprofile\AppData\Local\"
    Local $ArraySrtfiles = _FileListToArrayRec($dir, "tw-*.tmp", $FLTAR_FOLDERS)
    If Not IsArray($ArraySrtfiles) Then
        ConsoleWrite($dir & " = Invalid input path" & @CRLF)
        Return
    Else
        For $x = 1 To $ArraySrtfiles[0]
            ConsoleWrite($x & ") " & $dir & $ArraySrtfiles[$x] & " DirRemove=" & DirRemove($dir & $ArraySrtfiles[$x], 1) & @CRLF)
        Next
    EndIf
EndFunc   ;==>_DelAllFile

 

The temporary folder has been deleted in the above way. thank you

Link to comment
Share on other sites

This is the %localappdata% directory of the SYSTEM account. Why do you want to delete content in that folder? Usually there just remain empty TMP folders, that do not harm.

This is visible, when you start a CMD box as SYSTEM

  1. start a CMD box using "run as administrator"
  2. Get the sysinternals tool PSEXEC
  3. open a CMD box running as SYSTEM
PsExec.exe -sid cmd

--> new CMD box will open

Microsoft Windows [Version 10.0.19044.2006]
(c) Microsoft Corporation. Alle Rechte vorbehalten.

C:\WINDOWS\system32>whoami
nt-autorität\system

C:\WINDOWS\system32>cd %localappdata%

C:\Windows\System32\config\systemprofile\AppData\Local>

 

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...