| User: Ben Huffman -- 2009-08-26 << 348 350 >> |
| Hits: 4217 |
| Type: Batch file rename |
| Search all Batch file rename examples |
| Description: |
| How can I rename files from a specified string inside of a text file? (Not on the first line.) |
| Input Sample: |
| I would like to leave the original content of the file untouched and rename it using data contained in the file. (Note: I have ~800 files to do) Text contained within text file is STR(12) ' C12/m1 phase_name "Actinolite" ' Formula "Na0.8 Ca1.73 Mg1.88 Mn0.16 Fe2.72 Fe0.32 Al0.32 Si7.68 O22 (OH)2" ' Group "Silicate" ' SubGroup "Amphibole" ' UserGroup "" ' SubstSeries "Actinolite" ' ICDD_number 250157 a a_actinoli 9.8900 min |
| Output Sample: |
| Desired file name output would be Actinolite_Na0.8 Ca1.73 Mg1.88 Mn0.16 Fe2.72 Fe0.32 Al0.32 Si7.68 O22 (OH)2_250157 "phase_name"_"Formula"_"ICDD_number".str I understand that this may be overly complex, but I thought I would ask so I don't have to try to code something from scratch. Is it even possible to grab information from something other than the first line? Maybe Do it in steps by leaving the original file name and adding one line at a time? Thanks regardless of the outcome. |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
| This is a challenge, but not for Replace Pioneer: *** require Replace Pioneer 2.44 and above *** 1. open menu "Tools->Batch Runner" 2. click "Pick Files" to select multiple files 3. check "Set output filename" option, change ${FILENAME} to: 4. check if the new name in "output file" column is correct. 5. click "File Rename", done. Note: 1. above procedure may not be very efficient, since it read each file 3 times. 2. if your content are not in first 1000 bytes, but within first 3000 bytes, use |
Screenshot 1: Batch_Runner_Window |