Make multiple copies of a folder (and it's content) at once
Moderators: Hacker, petermad, Stefan2, white
Make multiple copies of a folder (and it's content) at once
As the title says, how can I do that ?
It's weird there's no explicit button/shortcut for this basic operation :< (unless im blind and didnt see it while searching for like 15 minutes in the help and on google xD)
Thanks in advance
ps: The destination is the same current location, names could be incremented or whatever, i'll rename them anyway after that (im talking about arround 20-25 copies)
It's weird there's no explicit button/shortcut for this basic operation :< (unless im blind and didnt see it while searching for like 15 minutes in the help and on google xD)
Thanks in advance
ps: The destination is the same current location, names could be incremented or whatever, i'll rename them anyway after that (im talking about arround 20-25 copies)
You can use Ctrl+C and Ctrl+V like in Explorer (this will use Explorer copy method, so the directory will get numbered incrementally).
Or you can use Shift+F5 to copy within the same panel (directory) and provide a new name in the process.
Regards
Dalai
Or you can use Shift+F5 to copy within the same panel (directory) and provide a new name in the process.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
It seems we have different understandings of basic operations. I can't remember any case when I've needed to make 25 copies of a folder at once.It's weird there's no explicit button/shortcut for this basic operation
And I don't know any file manager that provides such function. Explorer can't do that too.
Usually scripts are used for such non-standard requests. However there are some ways just within TC:
1. You can do this in a single command line request:
Code: Select all
for /l %i in (1,1,25) do xcopy /e "source_dir" "target_dir%i\"
2. Also you can do that in 5-6 copy operations using simple manual loop: select a dir, Ctrl+C, Ctrl+V, then select both dirs, Ctrl+C, Ctrl+V, then select all 4 dirs etc.
Batch: Create multiple copies of an file or folder
Hi and welcome.batis610 wrote:As the title says, how can I do that ?
Make multiple copies of a folder (and it's content) at once
There is no build-in command for this, as this is something not every user needs on a every day basic.
Luckily (as others pointing out already) you can customize TC to your needs.
To solve your task you could just use the standard tools of your OS as already stated above.
Here is a DOS BATCH script with some more comfort to create multiple copies of a selected file or a folder:
Code: Select all
@ECHO OFF
REM ==================================================== === Description ===
REM ____ _ _ _
REM | _ \ ___ ___ ___ _ __ (_) _ __ | |_ (_) ___ _ __
REM | | | | / _ \ / __| / __| | '__| | | | '_ \ | __| | | / _ \ | '_ \
REM | |_| | | __/ \__ \ | (__ | | | | | |_) | | |_ | | | (_) | | | | |
REM |____/ \___| |___/ \___| |_| |_| | .__/ \__| |_| \___/ |_| |_|
REM |_|
ECHO Copy one file or folder to many into the same folder, Stefan 2015 & ECHO.
REM 2012-09-28 v001 by Stefan : initial release
REM 2015-09-01 v002 by Stefan : work on folders too
REM 2015-09-01 v003 by Stefan : use additionally "%T" Parameters to create in other panel.
REM ==================================================== === Purpose ===
REM ____
REM | _ \ _ _ _ __ _ __ ___ ___ ___
REM | |_) | | | | | | '__| | '_ \ / _ \ / __| / _ \
REM | __/ | |_| | | | | |_) | | (_) | \__ \ | __/
REM |_| \__,_| |_| | .__/ \___/ |___/ \___|
REM |_|
REM Example: copy "TeST.tif" to "TeST_0001.tif", "TeST_0002.tif", "TeST_0003.tif",...
REM Example: copy "TestFld" to "TestFld_0001", "TestFld_0002", "TestFld_0003",...
REM ==================================================== === Example ===
REM _____ _
REM | ____| __ __ __ _ _ __ ___ _ __ | | ___
REM | _| \ \/ / / _` | | '_ ` _ \ | '_ \ | | / _ \
REM | |___ > < | (_| | | | | | | | | |_) | | | | __/
REM |_____| /_/\_\ \__,_| |_| |_| |_| | .__/ |_| \___|
REM |_|
REM Out of:
REM Test.txt
REM >>> create copies with originally content:
REM Test_0001.txt
REM Test_0002.txt
REM Test_0003.txt
REM
REM Out of:
REM Test Folder Leerzeichen\
REM >>> create copies with originally content:
REM Test Folder Leerzeichen_0001\
REM Test Folder Leerzeichen_0002\
REM Test Folder Leerzeichen_0003\
REM ==================================================== === Set-up ===
REM ____ _
REM / ___| ___ | |_ _ _ _ __
REM \___ \ / _ \ | __| _____ | | | | | '_ \
REM ___) | | __/ | |_ |_____| | |_| | | |_) |
REM |____/ \___| \__| \__,_| | .__/
REM |_|
REM In Total Commander, create a user button, with the path to this script as Command,
REM and %P%N as Parameter. (More http://ghisler.ch/board/viewtopic.php?p=287965#287965)
REM NEW: use %P%N "%T" as Parameters to create in other panel due to TCs "%T" param.
REM
REM You can also setup a user defined command in usercmd.ini to use this script in TCs menu
REM or to add a shortcut. (More http://ghisler.ch/board/viewtopic.php?p=291895#291895)
REM Next, select a file or a folder and execute this script; you will be prompted for your wishes...
REM ==================================================== === User Settings ===
REM _ _ _____ _ _ _
REM | | | | / ___| | | | | (_)
REM | | | | ___ ___ _ __ \ `--. ___ | |_ | |_ _ _ __ __ _ ___
REM | | | |/ __| / _ \| '__| `--. \ / _ \| __|| __|| || '_ \ / _` |/ __|
REM | |_| |\__ \| __/| | /\__/ /| __/| |_ | |_ | || | | || (_| |\__ \
REM \___/ |___/ \___||_| \____/ \___| \__| \__||_||_| |_| \__, ||___/
REM __/ |
REM |___/
REM Here you could set-up the behaviour of this script to your demand.
REM But its pre-set for easy use already.
REM Set an existing file to copy:
REM SET ORIG=TeST.tif
REM Get file name as command line parameter %1 (due to TCs %P%N)
SET ORIG=%~1
REM Base name before numbering ("TeST"):
SET BASE=%~n1
REM delimiter between BASE and numbering ("TeST_"):
SET DELIM=_
REM The numbering will be inserted automatically ("TeST_0001").
REM Padding to 4 digits by adding zeros is controlled by this PAD=n:
REM PAD=3 > 001, 002, 003
REM PAD=4 > 0001, 0002, 0003
SET PAD=4
REM Extension (".tif"):
SET EXTE=%~x1
REM Set target folder from command line parameter %2 (due to TCs %P%N "%T" param)
REM To copy just in current same folder, just do not us second TC parameter "%T"
SET TARGETFLD=%~2
REM ==================================================== === The Code, don't touch ===
REM _____ _ _____ _
REM |_ _|| | / __ \ | |
REM | | | |__ ___ | / \/ ___ __| | ___
REM | | | '_ \ / _ \ | | / _ \ / _` | / _ \
REM | | | | | || __/ | \__/\| (_) || (_| || __/
REM \_/ |_| |_| \___| \____/ \___/ \__,_| \___|
REM Check: Work on file or folder?
SET FLD=0 & SET ITEM=file & IF Exist "%ORIG%" SET FLD=1 & SET ITEM=folder
REM Set a delimiter line:
SET FORMATINGLINE=---------------------------------------
REM If no TC parameter %T for Target panel is used, use current folder as target:
IF ["%TARGETFLD%"]==[""] SET TARGETFLD=%CD%\
ECHO %FORMATINGLINE%
REM How many copies do you want:
ECHO Original: "%ORIG%" %ITEM%
ECHO Target folder: "%TARGETFLD%"
REM SET AMOUNT=10
SET /P "AMOUNT=How many more copies do you want: "
ECHO %FORMATINGLINE%
IF not exist "%ORIG%" GoTo ERROR
ECHO. & ECHO. & ECHO %FORMATINGLINE% & ECHO Command to execute:
ECHO COPY "%ORIG%" %ITEM% %AMOUNT% times
ECHO as "%TARGETFLD%%BASE%%DELIM%digit%EXTE%" %ITEM%s ?
ECHO.
ECHO Press "Ctrl+C" keys to break here and cancel. Press ENTER key to process.
ECHO Waiting for you....
ECHO %FORMATINGLINE%
PAUSE >NUL
ECHO. & ECHO. & ECHO %FORMATINGLINE%
ECHO Working, creating %AMOUNT% copies, please wait...
CD %~dp0
REM ==================================================== === main code ===
setLocal EnableDelayedExpansion
REM Copy "Base.Exte" (<start at>,<step>,<max amount>) to "Base_0001.Exte"
FOR /L %%D in (1,1,%AMOUNT%) DO (
SET digit=00000000%%D
SET digit=!digit:~-%PAD%!
IF %FLD%==0 (
IF EXIST "%TARGETFLD%%BASE%%DELIM%!digit!%EXTE%" (
ECHO Skipping: "%BASE%%DELIM%!digit!%EXTE%" %ITEM%, already exists.
) else (
ECHO Creating: "%BASE%%DELIM%!digit!%EXTE%" %ITEM%
COPY "%ORIG%" "%TARGETFLD%%BASE%%DELIM%!digit!%EXTE%" >NUL
)
)
IF %FLD%==1 (
IF EXIST "%TARGETFLD%%BASE%%DELIM%!digit!%EXTE%" (
ECHO Skipping: "%BASE%%DELIM%!digit!%EXTE%" %ITEM%, already exists.
) else (
ECHO Creating: "%BASE%%DELIM%!digit!%EXTE%" %ITEM%
XCOPY /K/R/E/I/S/C/H "%ORIG%" "%TARGETFLD%%BASE%%DELIM%!digit!%EXTE%" >NUL
)
)
)
ECHO. & ECHO All done! & ECHO %FORMATINGLINE% & PAUSE & GoTo :EOF
REM ==================================================== === /code ===
REM Little message on error:
:ERROR
ECHO. & ECHO Base file %ORIG% not found? Script will quit here. & PAUSE
REM ==================================================== === <EOF> ===
REM __ _____ ___ _____ __
REM / / | ____| / _ \ | ___| \ \
REM / / | _| | | | | | |_ \ \
REM \ \ | |___ | |_| | | _| / /
REM \_\ |_____| \___/ |_| /_/ <<< Art by http://patorjk.com/software/taag/
REM In Total Commander, create a user button, with the path to this script as Command, and %P%N as Parameter. (More http://ghisler.ch/board/viewtopic.php?p=287965#287965)
REM NEW: use %P%N "%T" as Parameters to create in other panel due to TCs "%T" param.
How to create an button
Right click on the button bar at the top and select "Change..."
In the "Change button bar" dialog, click "Add", then fill in the properties as follows:
Command = < full or relative path to the batch file>
Parameters = < %P%N or %P%N "%T" (press F1 key for help)>
Start path = < leave empty>
Icon file = <e.g.: %commander_path%\WCMICONS.DLL>
Tooltip = <a hint for you, so you still know next week what this button do>
Then click OK to create the button.
HTH?
@stefan
Amazing explanations... however there's a problem, this is what I get: (I tested with this FF shortcut)
Image: https://i.imgur.com/Wguyi54.png
I'll try the other methods too and post back here...
Amazing explanations... however there's a problem, this is what I get: (I tested with this FF shortcut)
Image: https://i.imgur.com/Wguyi54.png
I'll try the other methods too and post back here...
2batis610
Yes, you have modified The Code yourself.
Did you have tried the original script from above too?
Yes, you have modified The Code yourself.
Did you have tried the original script from above too?