Hello folks,
Just a quick question: Is there an easy function I'm missing to duplicate a file x number of times ?
I'm an animator and very often I need to copy a frame x number of times as placeholders until a final sequence is ready.
Create X duplicates of file ?
Moderators: Hacker, petermad, Stefan2, white
Clone one to many. Copy amount of times. Create duplicates
We would do that by utilizing a script (Batch, VBS, PoSh)
in conjunction with the TC variable to get the selected file.
For better understanding
- right click an button in the button bar
- chose "Change..."
- in that dialog press F1 key, scroll down and read for %P%N and such
- - -
A possible script could be like this:
Explanation:
-------------------------------------------------------------
Set up for use with TC:
- Copy that code into a new text file with CMD extension, located in your TC folder.
- Drag and drop that file onto TCs' button bar.
- Right click that button and chose Change...
Command: path\to\the\script.ext (to be portable you can exchange the path with %Commander_Path%)
Parameters: ?%P%N 13
Start path:
Icon file: WCMICONS.DLL
Tooltip: Copy selected file to many
-------------------------------------------------------------
Usage:
- select your file
- execute the script from the button
- change the 13 to the wanted amount
- click OK
-------------------------------------------------------------
## ## ##
Or with PoSh in TC notation:
Command: PowerShell
Parameter ?1..13 | ForEach{COPY '%P%N' $("""%P%O_{0:D4}.%E""" -f $_)}
in conjunction with the TC variable to get the selected file.
For better understanding
- right click an button in the button bar
- chose "Change..."
- in that dialog press F1 key, scroll down and read for %P%N and such
- - -
A possible script could be like this:
Explanation:
-------------------------------------------------------------
Set up for use with TC:
- Copy that code into a new text file with CMD extension, located in your TC folder.
- Drag and drop that file onto TCs' button bar.
- Right click that button and chose Change...
Command: path\to\the\script.ext (to be portable you can exchange the path with %Commander_Path%)
Parameters: ?%P%N 13
Start path:
Icon file: WCMICONS.DLL
Tooltip: Copy selected file to many
-------------------------------------------------------------
Usage:
- select your file
- execute the script from the button
- change the 13 to the wanted amount
- click OK
-------------------------------------------------------------
Code: Select all
@ECHO OFF
REM Clone one file to many. Stefan, 2014-10-09, v0.001
REM Parameters: %1 == File to clone; %2 == Amount of copies
REM === User Settings === === === === === === === === ===
REM Existing file to copy:
REM SET Orig=Template.xls
SET Orig="%1"
REM Base name before numbering for new files:
REM SET BASE=Template_Copy_
SET BASE=%~n1
REM pad the number to 4 digits by adding leading zero's:
SET pad=4
REM How many copies do you want:
REM SET AMOUNT=13
SET AMOUNT=%2
if "%AMOUNT%"=="" SET AMOUNT=5
REM Extension:
REM SET EXTE=XLS
SET EXTE=%~x1
REM Debug === === === === === ===
ECHO Origin: %Orig%
ECHO NEW: %BASE% number.%EXTE%
REM === The Code, don't touch === === === === === === ===
setLocal EnableDelayedExpansion
for /L %%D in (1,1,%AMOUNT%) DO (
SET digit=00000000%%D
SET digit=!digit:~-%pad%!
COPY "%Orig%" "%BASE% !digit!".%EXTE%
)
ECHO Created %Orig% !digit! times!
PAUSE
GoTo :EOF
Explanation:
-------------------------------------------------------------
Set up for use with TC:
- Copy that code into a new text file with CMD extension, located in your TC folder.
- Drag and drop that file onto TCs' button bar.
- Right click that button and chose Change...
Command: path\to\the\script.ext
(to be portable you can exchange the path with %Commander_Path%)
Parameters: ?%P%N 13
Start path:
Icon file: WCMICONS.DLL
Tooltip: Copy selected file to many
-------------------------------------------------------------
Usage:
- select your file
- execute the script from the button
- change the 13 to the wanted amount
- click OK
-------------------------------------------------------------
## ## ##
Or with PoSh in TC notation:
Command: PowerShell
Parameter ?1..13 | ForEach{COPY '%P%N' $("""%P%O_{0:D4}.%E""" -f $_)}
-
- Junior Member
- Posts: 12
- Joined: 2014-01-10, 15:27 UTC