473,396 Members | 1,749 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,396 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 6404
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: 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
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.