Solved

Create a list of variables via a wildcard

Posted on 2006-10-23
3
164 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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