views:

108

answers:

1

I have created a filing system containing folders as templates for re-creating a set of information to be used when we accept bookings and need a batch command to rename all files within a directory but in a very specific way. So to be more precise the directory contains: one file is an invoice template (PDF form) and another is a job description template (MSWord) and yet another is an additional template for special purpose (Also MSword).
There are a few more files also but i guess i don't need to name them all.

What i do each time i process a booking, is to copy the template directory (containing all these file templates) and then re-name it according to job number. I then re-locate it under a "bookings" directory and drop it into the folder representing the month of the year the job is booked for.

In the very first step, how could i get all the files within the directory to rename automatically to suit. Each file in th edirectory is named differently but when i am finished renaming each file manually they all share the one common factor which is the job number. So what i need is just for part of each of the file names to change to the job number for that booking, leaving the rest of the file name as it was. i figure this will save alot of time with the number of bookings i process. (CRM software is on the horizon but still a little too far away at this stage).

For example if i change the template directory from the name "template" to "CFI-00123 (1P2H)" then within the directory a file named "invoice# 000.pdf" should become "invoice# CFI-00123.pdf" and another file named "job# 000.docx" should become "job# CFI-00123.docx"

What complicates things: a job number looks something like this: CFI-00123 (2PBR). So the directory will be named as that exactly. However the part that i want to be replicated in the files within, is the "CFI-000123" only and not the part in bracketts (2PBR). This is just additional inforamtion that helps me identify at a glance what the requirement of the job is and i don't need each of the files within to reflect this.

I have never written batch code and i have a vague understanding when using html so i need someone to tell me exactly what to do and what to write.

thank you for your time in advance and if you have any questions i'll try to be as clear as possible. Hope this is not too difficult to understand.

Cheers, Danny.

A: 

To start with, does this layout seems ok?

  _Software
      |_Booking
          |_Template
          |_...
          |_CFI-00120 (1P2H)
          |_CFI-00121 (1P2H)
          |_CFI-00122 (1P2H)
          |_CFI-00123 (1P2H)

-Second, yes all files needing to be renamed need be listed in OP, so edit your post and add then, in a list for ease of reading.

Comment this post so I read again.

Jay