Solved

Create a list of variables via a wildcard

Posted on 2006-10-23
3
163 Views
Last Modified: 2010-04-24
I would like to create some variables that would list 3-4 files with the same name, but have different extensions.  So the user can click on a file such as:  \\server\location\testfile.xpi and then I can get a list of all the files with the same name but have different extensions such as:
X=\\server\location\testfile.xpi
Y=\\server\location\testfile.zip
Z=\\server\location\testfile.lsi

I currently have my script setup to where the user can click on one filename and create the x variable, but not sure how I can automate it to add the other 2-3 variables.
Thanks, Chad
0
Comment
Question by:chadmanvb
3 Comments
 
LVL 13

Expert Comment

by:newyuppie
ID: 17793491
there's the FileInfo class in system.IO, where you can separate filenames from extensions, or directory names, etc. its pretty useful
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 17793587
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryinfoclassgetfilestopic2.asp

Strip off the extension and replace it with *:

    \\server\location\testfile.*

Pass that to GetFiles() and it will return the list you want...
0
 

Author Comment

by:chadmanvb
ID: 17800643
getfiles() worked great.  Thanks, Chad
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.Net - For Loop Error 5 36
Create XML 5 46
VB.NET bulk update  of a table from another table 4 36
VS.net 2010 11 22
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now