Hi,
I am relatively new to batch files and I hope someone can help me please.
I have a folder which contains 10,000 client files. Each client can have 3 or 4 files. The naming convention for the files is as follows
document_1_client_dd123ccc.doc
document_2_client_dd123ccc.doc
document_3_client_dd123ccc.doc
document_1_client_gg333ddd.doc
document_2_client_gg333ddd.doc etc. etc
I need to attach information regarding these files to a database. At present I run a simple batch file which collects the names of the files into a txt file in the folder. The batch file is as follows,
cd\
cd\MyDir\FolderName
DIR /B "%*"*>C:\"MyDir\FolderName\FileNameList.txt"
The FileNameList.txt file contains all the names of the files as follows.
document_1_client_dd123ccc.doc
document_2_client_dd123ccc.doc
document_3_client_dd123ccc.doc
document_1_client_gg333ddd.doc
document_2_client_gg333ddd.doc
I then link the table in the database to the FileNameList.txt file and it works fine.
However to improve this and this is where I need help, I want to extract the client identification part of the file names into a second (comma separated) column in the FileNameList.txt file, which should look like this when it finishes,
document_1_client_dd123ccc.doc, dd123ccc
document_2_client_dd123ccc.doc, dd123ccc
document_3_client_dd123ccc.doc, dd123ccc
document_1_client_gg333ddd.doc, gg333ddd
document_2_client_gg333ddd.doc, gg333ddd
Is this possible? I would really appreciate any help anyone can give me.
Many thanks in advance.