mkDir: How to create button to make a folder ?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
kc_93
New Member
New Member
Posts: 1
Joined: 2023-10-03, 20:31 UTC

mkDir: How to create button to make a folder ?

Post by *kc_93 »

Hi, I have a question. How to create shortcut button to make a folder with defined name?.

For example: I want to create new folder (pressing f7) and automatically in new name of folder I want - <[Y]-[M]-[D]\folder_A\..\Folder_B\

How to do it so you don't have to type the name manually.
hi5
Power Member
Power Member
Posts: 637
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: mkDir

Post by *hi5 »

There is a cm_MkDir command but I don't think it supports parameters (if I'm wrong no doubt others will post a correct solution)

I would use the mkdir dos command combined with the %$DATE% variable that was recently introduced in v11

Right click on a button bar, or create a start menu item, or a user command (edit usercmd.ini manually), command:

Code: Select all

%comspec% /c mkdir %$DATE:Y-M-D%\folder_A\ %$DATE:Y-M-D%\Folder_B\
Or copy these lines and "paste" it on a free spot on you button bar

Code: Select all

TOTALCMD#BAR#DATA
%comspec% /c mkdir %$DATE:Y-M-D%\folder_A\ %$DATE:Y-M-D%\Folder_B\

wcmicons.dll,29
Create Dirs


-1
User avatar
beb
Power Member
Power Member
Posts: 579
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: mkDir

Post by *beb »

hi5 wrote: 2023-10-03, 21:13 UTC There is a cm_MkDir command but I don't think it supports parameters...
My vote goes for the cm_MkDir command to have customizable parameters of the same level as, e.g., the cm_Edit command does.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: mkDir

Post by *Fla$her »

beb wrote: 2023-10-05, 18:39 UTC My vote goes for the cm_MkDir command to have customizable parameters of the same level as, e.g., the cm_Edit command does.
Why not create a thread where it belongs?
Overquoting is evil! 👎
XiaoP76
New Member
New Member
Posts: 1
Joined: 2024-06-21, 09:11 UTC

Re: mkDir: How to create button to make a folder ?

Post by *XiaoP76 »

Thanks !

Code: Select all

%comspec% /c mkdir %$DATE:yMD%
worked like a charm for me.

Is it possible to also select or go into the newly created directory ?

I tried

Code: Select all

%comspec% /c mkdir %$DATE:yMD%, cm_GotoDir %$DATE:yMD%
but it looks like cm_GotoDir doesn't take any parameters either.
The command creates a directory called "cm_GotoDir" instead of selecting or going into the date directory :D
Using Total Commander for more than a quarter of a century.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: mkDir: How to create button to make a folder ?

Post by *Stefan2 »

Hi and welcome.

For this idea you have first to create a "user defined command" in usercmd.ini for the MKDIR command.

Next you could try this command in an button
em_MkDir_yMD,cm_wait 500,cm_SrcByDateTime,cm_GoToFirstEntry,cm_Return ,cm_wait 500,cm_SrcByName


See text file TOTALCMD.inc in TC folder.



 
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: mkDir: How to create button to make a folder ?

Post by *white »

It seems more obvious to use command:

Code: Select all

em_MkDir_yMD,cm_wait 500,cd "%$DATE:yMD%"
And define em_MkDir_yMD as

Code: Select all

%comspec% /c mkdir %$DATE:yMD%
sa16
Senior Member
Senior Member
Posts: 324
Joined: 2021-09-10, 07:15 UTC

Re: mkDir: How to create button to make a folder ?

Post by *sa16 »

If the folder is not empty:

Code: Select all

cm_GoToNext,cm_Copy /GT="%$DATE:yMD%\"W="|* *\",cm_Wait 50,cd "%$DATE:yMD%"
Post Reply