How to delete a directory with vb.net if the directory contains long paths ?

  • Thread starter Arjan van den Noort
  • Start date
A

Arjan van den Noort

How to delete a directory (with all containing directories and files) with
vb.net if the directory contains long paths ?
(just like the dos command: RD /S/Q path)

What I want is a routine to delete files and folders from a shared folder
(accessed by its UNC-notation). That's all !
Some path names can be long (> 200 characters ) and there are some files and
folders that can be read-only.

The exceptions I get:
System.IO.File.SetAttributes() has problems with long paths:
PathTooLongException
System.IO.Directory.Delete() has problems with read-only files
(UnauthorizedAccessException) and has also problems with long paths
(DirectoryNotFoundException)
Working with Scripting.FileSystemObject also runs into problems when working
with long path-names.

Any suggestions ?

Regards,
Arjan van den Noort
ITC, Enschede, The Netherlands
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top