I used Lua to write a small tool to modify the file Suffix in batches.

Source: Internet
Author: User
1 -- [-- 2-renamefilepostfix _: uniformly rename the file suffix 3-@ Param: param1-original file suffix 4-@ Param: param2-target file suffix 5-@ Param: param3-destination file prefix name 6-@ Param: param4-destination file folder path 7-@ Param: param5-original file path 8-@ Param :... 9-@ Param: paramn-original file path 10 11] 12 local function renamefilepostfix (...) 13 local Arg = {...} 14 local filename = nil15 local fixf, fixt = Arg [1], arg [2] 16 local prefix = Arg [3] 17 local foldert = Arg [4] 18 for I = 5, # Arg do19 filename = Arg [I] 20 local filef = assert (Io. open (filename, "R +") 21 local filedata = filef: Read ("* All") 22 filef: Close () 23 24 local rename = foldert .. "/".. prefix .. "_".. (I-4 ).. ". ".. fixt25 local filet = assert (Io. open (rename, "W +") 26 filet: Write (filedata, rename) 27 filet. close () 28 end29 print ("done") 30 end31 32 ---@ Param: param1-original file suffix 33 ---@ Param: param2-target file suffix 34 ---@ Param: param3-destination file prefix 35 ---@ Param: param4-destination file folder path 36 ---@ Param: param5-original file path 37 ---@ Param :... 38 ---@ Param: paramn-original file path 39 renamefilepostfix (...)

Drag the code file to the command line for processing. variable parameters can be changed from 5th.

I used Lua to write a small tool to modify the file Suffix in batches.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.