5 pts.
 visual basic .net file deletion without full name
This is in regard to visual basic .NET I have a program, that creates file it name and reads them something like 'exadion@Donneschdeg 6 August 2009' (no extension) I am finding myself stuck however, I have written split string arrays to grab the parts i need to filter by, in this case the 'exadion' and the '2009' i need to delete any/all the files that start with 'exadion' (username) and end in '2009' (or any given year). Can anyone write a function to delete said files when you don't know what data will be in the middle? (just delete anything that starts with 'exadion' and ends with '2009')(username and year will be variables too btw).

Software/Hardware used:
ASKED: August 6, 2009  6:31 PM
UPDATED: August 6, 2009  7:09 PM

Answer Wiki:
I don't know if there is a way to delete all files in a single operation, but one option could be deleting the files one at a time. Something like this (you would have to make the necessary changes to make the username and year variables): <pre>For Each foundFile As String In My.Computer.FileSystem.GetFiles( _ My.Computer.FileSystem.SpecialDirectories.MyDocuments, _ FileIO.SearchOption.SearchAllSubDirectories, "exadion*2009") My.Computer.FileSystem.DeleteFile(foundFile, _ FileIO.UIOption.AllDialogs, _ FileIO.RecycleOption.DeletePermanently) Next</pre>
Last Wiki Answer Submitted:  August 6, 2009  7:09 pm  by  carlosdl   63,535 pts.
All Answer Wiki Contributors:  carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _