473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

File operation with user-set wildcards

I want to delete files but I also want to set the wildcards manually. Look at
this example:

If TextBox1.Text = "" Then
Else
For Each foundFile As String In
My.Computer.FileSystem.GetFiles(curdir & "\_res_original", _
FileIO.SearchOption.SearchAllSubDirectories, TextBox1.Text)
My.Computer.FileSystem.DeleteFile(foundFile)
Next
End If

------------

TextBox1.Text should look like <"*.exe", "*.txt", "*.ini">
It works with one extension but if I specify many of them, vb gives an error
that there is an illegal character. I suppose it handles the commas not
correctly.

Thanks for any help
Aug 24 '06 #1
5 1574
On Thu, 24 Aug 2006 06:56:01 -0700, kenny <ke***@discussions.microsoft.comwrote:
>I want to delete files but I also want to set the wildcards manually. Look at
this example:

If TextBox1.Text = "" Then
Else
For Each foundFile As String In
My.Computer.FileSystem.GetFiles(curdir & "\_res_original", _
FileIO.SearchOption.SearchAllSubDirectories, TextBox1.Text)
My.Computer.FileSystem.DeleteFile(foundFile)
Next
End If

------------

TextBox1.Text should look like <"*.exe", "*.txt", "*.ini">
It works with one extension but if I specify many of them, vb gives an error
that there is an illegal character. I suppose it handles the commas not
correctly.

Thanks for any help

The argument for wildcard parameters is a string array:
Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"}

Change ....SearchAllSubDirectories, TextBox1.Text
to
.....SearchAllSubDirectories, FileTypes
Gene
Aug 24 '06 #2
Thanks.
But how can I convert the string from the textbox into a string array so it
will be recognized as separated wildcards?

"gene kelley" schrieb:
>

The argument for wildcard parameters is a string array:
Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"}

Change ....SearchAllSubDirectories, TextBox1.Text
to
.....SearchAllSubDirectories, FileTypes
Gene
Aug 25 '06 #3
This returns a string array:

TextBox1.Text.split(","c)

hope this helps

Greetz, Peter


--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"kenny" <ke***@discussions.microsoft.comschreef in bericht
news:7C**********************************@microsof t.com...
Thanks.
But how can I convert the string from the textbox into a string array so
it
will be recognized as separated wildcards?

"gene kelley" schrieb:


The argument for wildcard parameters is a string array:
Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"}

Change ....SearchAllSubDirectories, TextBox1.Text
to
.....SearchAllSubDirectories, FileTypes
Gene

Aug 25 '06 #4
Alright, it works.
I forgot to write the c, that was the problem.
Thank you both for helping me!

"Peter Proost" schrieb:
This returns a string array:

TextBox1.Text.split(","c)

hope this helps

Greetz, Peter


--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"kenny" <ke***@discussions.microsoft.comschreef in bericht
news:7C**********************************@microsof t.com...
Thanks.
But how can I convert the string from the textbox into a string array so
it
will be recognized as separated wildcards?

"gene kelley" schrieb:
>
>
The argument for wildcard parameters is a string array:
Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"}
>
Change ....SearchAllSubDirectories, TextBox1.Text
to
.....SearchAllSubDirectories, FileTypes
>
>
Gene
>


Aug 25 '06 #5
You're welcome

Greetz, Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"kenny" <ke***@discussions.microsoft.comschreef in bericht
news:8C**********************************@microsof t.com...
Alright, it works.
I forgot to write the c, that was the problem.
Thank you both for helping me!

"Peter Proost" schrieb:
This returns a string array:

TextBox1.Text.split(","c)

hope this helps

Greetz, Peter


--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to
produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"kenny" <ke***@discussions.microsoft.comschreef in bericht
news:7C**********************************@microsof t.com...
Thanks.
But how can I convert the string from the textbox into a string array
so
it
will be recognized as separated wildcards?
>
"gene kelley" schrieb:


The argument for wildcard parameters is a string array:
Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"}

Change ....SearchAllSubDirectories, TextBox1.Text
to
.....SearchAllSubDirectories, FileTypes


Gene

Aug 25 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: vanitha | last post by:
I am developing a Web Interface for a embedded target using CGI-C. I have a requirement, which requires a HTML page to be continuously updated by the server.ie.,I am dynamically updating the fields...
14
by: Michael R. Copeland | last post by:
I'm writing an application that requires an "intelligent merge" of 2 files. That is, equal data has a "preferred source" that I want to write out. What I have works, I believe, but it seems...
0
by: suresh | last post by:
Hello All, Iam writing a wsdl file using the Servicedescription class.The document I get is a well formed xml document.But some how when I try to add this wsdl file as a webrefernce to another...
4
by: Peter Lin | last post by:
Dear all; I need to monitor a xml file so that I can update my data in hashtable, but the problem is it will trigger more than one event for a lastwrite action(I trigger this action by add...
1
by: moonriver | last post by:
In a xml file, can we make reference to another xml file so that all contents of the latter xml file will be included into the first xml file? Had better give me an example for details.
32
by: Olivier | last post by:
Dear all, I thought the code ----------------------------- pt_fichier_probleme = fopen(nom_fichier, "w"); if(pt_fichier_probleme == NULL){ message_warning_s ("Erreur l'ouverture du...
7
by: ConfusedAlot | last post by:
This is my code for a database, whenever i save the database to the file 'database.txt' and display the results i get this; name - (correct, is what i put in) pin - 3435973836 slew rate -...
12
by: lalou89 | last post by:
Develop a simple text editor program. The program will show the user a menu of choices and will act according to his choice. Use functional decomposition to break the system into small functions that...
6
by: hiteshc.techie | last post by:
Hi All, Can we do file I/O on the client system using Javascript? Or is there any other option available. Thnx
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.