473,386 Members | 1,621 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.

move a file with a wildcard

I need to move a file from one location (Source) to
another (Destination). I currently use:

System.IO.File.Move(source, destination)

My problem is that the source file name changes. It is
called FileXXXX.txt where XXXX is the timestamp of when
the file was created. I want to read in this file using a
wildcard and move it to a different location. Thus I want
to be able to find File*.txt. How can I do this? It
fails if I have * in my source string. There there a
special syntax I must use?
Jul 19 '05 #1
1 6399
In article <00****************************@phx.gbl>,
Ke********@agservices.com says...
I need to move a file from one location (Source) to
another (Destination). I currently use:

System.IO.File.Move(source, destination)

My problem is that the source file name changes. It is
called FileXXXX.txt where XXXX is the timestamp of when
the file was created. I want to read in this file using a
wildcard and move it to a different location. Thus I want
to be able to find File*.txt. How can I do this? It
fails if I have * in my source string. There there a
special syntax I must use?


I think you'll need to use Directory.GetFiles() to get all the files
that match your search criteria (File*.txt). Then loop through the
result and move each file seperately.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Jul 19 '05 #2

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

Similar topics

1
by: Generic Usenet Account | last post by:
Here's the requirement that I am trying to satisfy: Handle wildcards in STL such that the wildcard entry is encountered before non-wildcard entries while traversing containers like sets and...
1
by: deko | last post by:
I have a form where users can enter a string with asterisks to perform a wildcard search. Currently, the string entered by the user looks like this: *somestring* The purpose is to match any...
1
by: Mark | last post by:
Hi All, Sorry if this is a basic question but I can't get this to work. I have files randomly FTP'd to a directory and I need to import them. That I can do but what I can't do is move them once...
3
by: Dan W | last post by:
Hi there. I am parsing a text file and as I parse each line I need to go out to two different directories and check to see if any files beginning with the string I just parsed exist. For...
2
by: Kevin Rose | last post by:
I need to move a file from one location (Source) to another (Destination). I currently use: System.IO.File.Move(source, destination) My problem is that the source file name changes. It is...
3
by: Lou | last post by:
Question: I can't seem to get file.exists(filename) to return true when I search using wildcards, and I know there's a file in that dir with that extension. here's the path dim yesno as...
6
by: Jan Kucera | last post by:
Hi, does anybody know about wildcard mapping ASP.NET 2 in IIS6? Any tutorial? Thanks, Jan
5
by: Krustov | last post by:
I have the following list of image files . When searching the latest (numbered file) in this particular case its background_4.*** and its a .jpg file - but - the latest file in the list could...
0
by: deve8ore | last post by:
Hi.... I'm getting closer to understanding the wildcard function in VBA, however we have a vendor that will supply us many files, and unfortunately will place them in different folders with no...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.