T
Tony!
I've got a directory that contains many files with the filespec
filename#stringof14chars.wav
i.e-
"011420091557_ABC00097_400_5193760521_0008A17F_631122_002#20090114155411.wav"
In a database table, I find the filename minus the # and all after it
i.e- "011420091557_ABC00097_400_5193760521_0008A17F_631122_002"
I'm trying to check if the filename pulled from the database table
exists in the directory of files.
I've got
if (File.Exists(RemoteDir + filename))
{
code
}
from where I was puilling the filenames looping through the directory
and checking for a match, but this dir is gonna grow by several
thousand every day (they back up files daily, but there is always
gonna be many thousand files there)
Figured it would be faster to get file list from table instead of
directory to speed things up, but I can't figure out the Regex syntax
to check for the filename with the full #...wav name while only having
the first part of the filename.
I ended up using this
String[] Found = Directory.GetFiles(RemoteDir, filename + "*.wav");
Which I thought would take just about as long as
String[] Filenames = Directory.GetFiles(Directory, "*.wav");
But it comes back in about a second.
But I still wonder.. for future reference., if I did do it using
Regex, how would I do it? Can I even do it using Regex?
Thanks,
Tony!
filename#stringof14chars.wav
i.e-
"011420091557_ABC00097_400_5193760521_0008A17F_631122_002#20090114155411.wav"
In a database table, I find the filename minus the # and all after it
i.e- "011420091557_ABC00097_400_5193760521_0008A17F_631122_002"
I'm trying to check if the filename pulled from the database table
exists in the directory of files.
I've got
if (File.Exists(RemoteDir + filename))
{
code
}
from where I was puilling the filenames looping through the directory
and checking for a match, but this dir is gonna grow by several
thousand every day (they back up files daily, but there is always
gonna be many thousand files there)
Figured it would be faster to get file list from table instead of
directory to speed things up, but I can't figure out the Regex syntax
to check for the filename with the full #...wav name while only having
the first part of the filename.
I ended up using this
String[] Found = Directory.GetFiles(RemoteDir, filename + "*.wav");
Which I thought would take just about as long as
String[] Filenames = Directory.GetFiles(Directory, "*.wav");
But it comes back in about a second.
But I still wonder.. for future reference., if I did do it using
Regex, how would I do it? Can I even do it using Regex?
Thanks,
Tony!