Jump to content

Recommended Posts

Posted

On an old version of a program we had, we would need to delete "cache" folders.  I would use the DirRemove to remove the directory and it's subdirectory.  Just for example, lets say the structure was C:\cache.  The subdirectories would be username1, username2, etc.  The next time the application was invoked, it would recreate the \cache directory.

With the new version of of the application, it turns out there is still a need to delete cache.  The difference here is that it doesn't appear the \cache directory gets recreated when the application launches again.

Is there a way to delete all of the files and subdirectories of the \cache folder without actually deleting the \cache folder?

If not, them I may have to delete the folder, then add a command to create the folder again.  I was hoping for one command though.

I'm sure this is an elementary issue compared to some of the other posts I've seen.  Thanks in advance for any help.

Posted (edited)

From the HelpFile, FileDelete entry:  Note: If the "path" passed to FileDelete() is a folder, the files therein will be deleted just as if you had used the *.* mask.
Good Luck,

Edit:  Sorry, I see you were looking to delete subdirectories.

_aleph_

Edited by aleph01

Meds.  They're not just for breakfast anymore. :'(

Posted

Try FileListToArray using $iFlag = 2  ($FLTA_FOLDERS (2) = Return Folders only)

Then reference your array elements in a For.Next Loop, deleting as you loop.

_aleph_

Meds.  They're not just for breakfast anymore. :'(

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