Duplicate

Title Duplicate
File Name Duplicate.txt
Description Make the preset number of copies of the file selected by adding a two-digit counter to the file name
Author Vochomurka
Parameters "%P%O", "%E"
Plugins Called file, win
Icon
Version 1.2
Updated on 23.06.2018
args PO, E
local Number, NewFile
local Source = PO ++ "." ++ E

;Sub_Spin – name of script Spin
local Count = .Subs\Sub_Spin(1, 1, 99, "Duplicate Script", "... copies", "", 0, 65, 40, 4, 12, 20, 27, 17, 14, 12, 4, 12, 30, 128, 35)

if(!Count)
	quit

;Sub_Spin – name of script Progress
.Subs\Sub_Progress(0, 0, Count, 0, 5000, "/", "")

for(i = 1; i <= Count; i++)
	Number = ifelse(i < 10, "0" ++ i, i)
	NewFile = PO ++ Number ++ "." ++ E
	file.copy(Source, NewFile)
	.Subs\Sub_Progress@Current(i)
endfor

win.sendmessage(win.handle("c=TTOTAL_CMD"), 0x400+51, 540, 0)

Comments:

Sometimes I need to produce many equal content files with different names. For example, if I want to make several web-pages with the same design, first of all I edit a template and then duplicate it. The only thing that remains is to fill every file with a specific information.

After running the script you have to enter the number of copies (from 1 to 99). For example, if the current file is a.txt and the value entered is 13, the following files will be created: a01.txt, a02.txt, … , a13.txt.


All Scripts Total Commander TotalCmd.net PowerPro