Jump to content

Recommended Posts

Posted

hi guys

 

does any one have any vb code that will the the folder contents of a folder on a local machine but leave the root folder in place

 

mark

Posted (edited)

deletes folders and files too

 

Dim fso, fldr
Set fso = CreateObject("Scripting.FilesystemObject")

Set fldr = fso.GetFolder("c:\test_area")

'delete subfolders
For Each subf In fldr.SubFolders

subf.Delete True

Next

'delete subfiles
For Each fsofile In fldr.Files

fsofile.Delete True

Next

 

edit: be careful where you run this, it deletes everthing below!

Edited by box_l

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



×
×
  • Create New...