Parsing a filename into seperate pieces
Posted: 18 Dec 2008 17:22
Hello!
I have a need to parse a set of filenames into seperate pieces for additional processing. The files will be of varing length, but with the same prefix and file extension. I need to strip the prefix and file extension off and the do another task on the part of the filename that is remaining and of course loop through a list of files.
In this example there are 3 files:
PrefixTable1.dat
PrefixDatabase.dat
PrefixArchive.dat
What I need assitance with is to strip Prefix and .dat from the 3 files, so that what is stored in a variable or variables is Table1, Database, and Archive.
Any help?
Thanks,
Doug
I have a need to parse a set of filenames into seperate pieces for additional processing. The files will be of varing length, but with the same prefix and file extension. I need to strip the prefix and file extension off and the do another task on the part of the filename that is remaining and of course loop through a list of files.
In this example there are 3 files:
PrefixTable1.dat
PrefixDatabase.dat
PrefixArchive.dat
What I need assitance with is to strip Prefix and .dat from the 3 files, so that what is stored in a variable or variables is Table1, Database, and Archive.
Any help?
Thanks,
Doug