Jump to content

Recommended Posts

Posted (edited)

You also need to check attributes of these files before deleting them, as stated in the Filedelete function help file:

Quote

Some file attributes can make the deletion impossible, if this is the case look at FileSetAttrib() to change the attributes of a file.

You can also use the del command from windows as an alternative:

;this function will delete everything inside a folder, without deleting the folder itself

func deletefoldercontent ($path)

RunWait(@ComSpec & " /c " & 'del /s /f /q "' & $path & "*.*" & '"', "", @SW_HIDE) ;delete all files in the directory and sub directories

RunWait(@ComSpec & " /c " & 'del /s /f /q "' & $path & "*.*" & '" /A:H', "", @SW_HIDE) ;delete all hidden files in the directory and sub directories

RunWait(@ComSpec & " /c " & 'for /f "delims=?" %f in (''dir /ad /b ' & '"' & $path & '"' & ''') do rd /s /q "' & $path & '%f"', "", @SW_HIDE) ;list all subfolders and delete them

EndFunc

deletefoldercontent(@UserProfileDir & "\Recent\)

 

Edited by Neutro

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
  • Recently Browsing   0 members

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