Sign in to follow this  
Followers 0
zac23

Delete temp files

9 posts in this topic

#1 ·  Posted (edited)

Hey im wrighting a script with a gui, ive got the gui to work but i cant figure out how to delete files from other perples user profiles without spesifying a user name to look at and not looking in the currrent user that is logged in, im sure im missing something simple any ideas?

Edited by zac23

Share this post


Link to post
Share on other sites



look at the Dirs :) just wright @ in index in the help file :)

Share this post


Link to post
Share on other sites

hey is there an example of this in help file?


Share this post


Link to post
Share on other sites

i got this so far but it dosent work need to do something with the "not' lol

func deletetmpfiles()

if FileExists("D:\userdata\*\Temp") not @UserName Then

FileDelete("D:\userdata\*\Temp")

Else

MsgBox(1,"DelTemp","temp Dose not exist!")

EndIf

EndFunc


Share this post


Link to post
Share on other sites

i got this so far but it dosent work need to do something with the "not' lol

func deletetmpfiles()

if FileExists("D:\userdata\*\Temp") not @UserName Then

FileDelete("D:\userdata\*\Temp")

Else

MsgBox(1,"DelTemp","temp Dose not exist!")

EndIf

EndFunc

Please consider working thru this tutorial on using AutoIt

http://www.autoitscript.com/forum/index.ph...st&p=607559

Also, it is not a good idea to delete every temp file - it might be best to only delete "old" ones.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Also, it is not a good idea to delete every temp file - it might be best to only delete "old" ones.


Share this post


Link to post
Share on other sites

But even a person that has logged off may have a temp file that is part of a document that can be recovered.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

But even a person that has logged off may have a temp file that is part of a document that can be recovered.

there meant to save anything to a network drive that also keeps a record of deleted stuf for a while

we go through and delete all of them anyway our operating system recreates anything important on logon too

im just trying to increase speed at which we speed up the pcs


Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I'm not sure what OS you're using, but this (based upon the help file example for "_FileListToArray") might be a good way to start:

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("C:\Documents and Settings\","*",2)
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList,"$FileList")
For $x = 1 to $FileList[0]
    Switch $FileList[$x]
        Case "LocalService", "NetworkService", @UserName; users to ignore
        Case Else; users to process
            MsgBox(1,"","Deleting temp files for: " & $FileList[$x])
    EndSwitch
Next

That example is tuned for my Windows XP Pro SP3...

Edit: added @UserName to switch statement

Edited by Spiff59

Share this post


Link to post
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
Sign in to follow this  
Followers 0