There are a couple of problems here, which mean that perhaps you want to rethink how you are doing the file header.
The first is that PadRight fixes a
minimum length for the string, not a maximum, so if your file name or code exceed 20 or 30 characters respectively, then your whole system goes to pieces, as you can't tell where one field ends and a new one begins.
The next is that DateTime.ToString is culture dependant: it will generate a date based on the settings the user has selected for his PC, and so your files may not be at all portable: a file written on one system will produce a different date (or an error) when read on a different PC.
If you want to use a file header line for a text file, then make it variable length, and separate the various parts with a character that isn't allowed in file names: '\t' or '?' for example. Then use a fixed data format such as
DateTime.Now.ToString("yyyyMMdd")
And just have it as a line of text:
20130523?myfile.txt?myCode?Ociffer
You can then retrieve the line very easily, and get the various parts with a simple string.Split operation.