Jump to content

File Delete funtion query


Recommended Posts

Hi,

I am newbie to AUTO IT and have written a script which deletes certain location(temporary folders,temp folder,history,recent) on a remote computer.

The script works fine deleting most locations,except for TEMP folder. I am taking the computer name and user name as input and encoding the values into defined path variables.

Eg:

Dim $Path="\\abcd109\C$\Document and Settings\username\Local Settings\Temp"

FileDelete($Path)

I have also tried FileRecycle function.

It is quite amazing that these functions work for Temporary Internet Files, Recent and History. I mean it deletes all files found in these folders, but does not delete any file or folder in Temp folder.

Any help would be highly appreciated.

Ta.

GSP

Link to comment
Share on other sites

Thanks.

I am trying to delete the files in Temp folder, not the folder itself. Also I believe Temp folder stores some files & folders which belong to active programs(these cannot be deleted). It would be a daunting task to specify each and every file extension in Temp folder. Any easy way to do this? Suggestions for functions or keywords? The help file is not detailed with these functions.

Link to comment
Share on other sites

try this 1

$a = FileFindFirstFile ("*.*")
while 1
$file = FileFindNextFile ($a)
if @error then ExitLoop
;msgbox (0, "", $file)
if stringleft ($file, 1) <> "~" and stringleft ($file, 1) <> "." and stringleft ($file, 1) <> ".." Then
FileDelete ($file)
Else
EndIf
WEnd

should work for tempdir you just have to change the filedest

have fun

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...