- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anybody help?
I am writing a Vb.Net "Addin" for Inventor.
I am trying to delete an existing file using a "Wildcard", but, I have tried various solutions but none seem to work!
For example:
Say I have a file called "Test123456.txt" and I want to delete it using the wildcard "Test*.txt" (* being the Wildcard).
Can anybody tell me how to do this?
Many thanks in advance!
Darren
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there.
You have to create a Directory Info object using the path of the folder that contains files you want to delete. And look for all files inside of it "Test*.text"
If you want to look for all sub folders, You can use this:
Dim dinfo As New DirectoryInfo(YOUR_FOLDER_PATH)
For Each myFile In dinfo.GetFiles("Test*.txt", SearchOption.AllDirectories)
File.Delete(myFile)
Next If you want to check only the folder you entered, not the subfolders then you have to change "SearchOption.AllDirectories" to "SearchOption.TopDirectoryOnly".
I hope it will help.
Regards
Devrim
Freundliche Grüße / Kind Regards