Hi,
I have a directory containing numerous files which I want to rename. The files are always 40 characters in length. Example files:
prtx010.prtx010.0199.126291.351.03053254
prtx010.prtx010.0199.336760.335.16530215
This part of the filename is always the same: [highlight #FCAF3E]prtx010.prtx010.0199.[/highlight]
The numbers in bold type (which can range from 000000 to 999999) are what I am interested in. They are always 6 characters in length. The last remaining characters are a Unix timestamp, which can be ignored.
What I want to do is loop through the directory and rename all files that are like the above examples (prtx010.prtx010.0199.*) and rename them as the bit in bold. So, in the above examples, the files would be renamed thus:
126291
336760
So, how would I accomplish this in C#?
Many thanks,
--
SM
I have a directory containing numerous files which I want to rename. The files are always 40 characters in length. Example files:
prtx010.prtx010.0199.126291.351.03053254
prtx010.prtx010.0199.336760.335.16530215
This part of the filename is always the same: [highlight #FCAF3E]prtx010.prtx010.0199.[/highlight]
The numbers in bold type (which can range from 000000 to 999999) are what I am interested in. They are always 6 characters in length. The last remaining characters are a Unix timestamp, which can be ignored.
What I want to do is loop through the directory and rename all files that are like the above examples (prtx010.prtx010.0199.*) and rename them as the bit in bold. So, in the above examples, the files would be renamed thus:
126291
336760
So, how would I accomplish this in C#?
Many thanks,
--
SM