Rename file based on data in file
Solved/Closed
Related:
- Rename file based on data in file
- Windows 10 iso file download 64-bit - Download - Windows
- Kmspico zip file download - Download - Other
- Rename computer cmd - Guide
- Dvi file - Guide
- Tiny 11 iso file download - Download - Windows
1 response
Richard.Williams
Posts
25
Registration date
Saturday November 7, 2009
Status
Member
Last seen
July 18, 2012
14
Sep 19, 2010 at 09:33 AM
Sep 19, 2010 at 09:33 AM
Here is a batch script.
Script is in biterscripting. Save the script in file C:/Scripts/Rename12.txt, run with this command in biterscripting.
It will rename all files in folder C:/test.
Please test first on a test folder.
# Script Rename12.txt var string folder var string list, file, content, field12 if ($folder=="") exit 1 "Error 1: folder not specified." endif cd $folder # Collect a list of files lf -n "*" > $list # Go thru files one by one while ($list <> "") do # Get the next file lex "1" $list > $file # Get the file's contents into a string variable. cat $file > $content # Get the value after 11th asterisk and before the next asterisk. stex "^*^11[" $content > $field12 ; stex "[^*^" $field12 > null # Rename file to the 12 field. system rename ("\""+$file+"\"") ("\"file_"+$field12+"\"") done
Script is in biterscripting. Save the script in file C:/Scripts/Rename12.txt, run with this command in biterscripting.
script "C:/Scripts/Rename12.txt" folder("C:/test")
It will rename all files in folder C:/test.
Please test first on a test folder.
Sep 20, 2010 at 07:01 AM
Lisa