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, osd
Icon
Version 1.1
Updated on 16.06.2014
local Number, NewFile
local Count = input "=2Enter number of files to duplicate"
if(not Count)
	quit

local Source = arg(1) ++ "." ++ arg(2)

osd.show("Wait...", "INFINITE", "48", "Arial Cyr", "-1", "255 000 000")

for(i = 1; i <= Count; i++)
	Number = i
	if(i < 10) do
		Number = "0" ++ i
	endif
	NewFile = arg(1) ++ Number ++ "." ++ arg(2)
	file.copy(Source, NewFile)
endfor

osd.show("Ready!", "1000", "48", "Arial Cyr", "-1", "000 255 000")
osd.hide

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.

As usual, if you don't want to see the job progress on the screen, just delete all lines beginning with osd. - there are three of them.


Main Page Total Commander PowerPro