Multi Commander Support Forum

Multi Commander => Script => Topic started by: chiefgra on May 12, 2014, 12:20:46

Title: create a new open folder with the current date
Post by: chiefgra on May 12, 2014, 12:20:46
how to create a new open folder with the current date in the active panel?
Title: Re: create a new open folder with the current date
Post by: Mathias (Author) on May 12, 2014, 18:14:54
Create a UserDefinedCommand of MultiScript type

And get the current time with gettime();  ( http://multicommander.com/docs/multiscript/functions/datetime#gettime )

Then format the time to what every format you want the datetime with formatdate ( http://multicommander.com/docs/multiscript/functions/datetime#formatdate )

Get the current source path as a base of the path where you add the datetime string to with GetSourcePath() ( http://multicommander.com/docs/multiscript/functions/getfilefromview#getsourcepath )

See this post for hints.
http://forum.multicommander.com/forum/index.php/topic,712.0.html
Title: Re: create a new open folder with the current date
Post by: chiefgra on May 13, 2014, 13:16:06
Create a UserDefinedCommand of Batch Script(.BAT) type

cmd /c md "%date:~0,2%.%date:~3,2%.%date:~6,4%-%time:~0,2%.%time:~3,2%.%time:~6,2%"


as go directly-open a folder?:-\
Title: Re: create a new open folder with the current date
Post by: Ulfhednar on May 31, 2014, 18:51:25
Decided to try making a script for this.

config/user defined commands -> new - insert name & decription; 
command type dropdown select - multiscript -

Code: [Select]
@var $now = GetTime();
@var $date = FormatDate( "dd-MM-yyyy" , $now );
@var $folder;
@var $FolderBaseName = GetSourcePath();
{
 $folder = $FolderBaseName ^ $date;
 MC.Filesystem.Makedir PATH="{$folder}"
 }

--gives a folder with current date in selected pane/path.

See also http://forum.multicommander.com/forum/index.php/topic,1197.msg4124.html#msg4124 (http://forum.multicommander.com/forum/index.php/topic,1197.msg4124.html#msg4124)
Title: Re: create a new open folder with the current date
Post by: mlabrkic on February 20, 2022, 19:17:07
tested (+ Ask user for folder name)  :)

Code: [Select]
// MC_Create_folder_your_input_and_date, F12

// MultiCommander script:
// Create a new folder (your input, current date and time)
// 2022-02M-20 18:07:48

// ---------------------------------------------------------
// http://forum.multicommander.com/forum/index.php/topic,1184.msg4072.html#msg4072
// Multi Commander Support Forum »Multi Commander »Script »create a new open folder with the current date
// Contributor: Ulfhednar

// Decided to try making a script for this.
// config/user defined commands -> new - insert name & decription;
// command type dropdown select - multiscript -

// See also
// http://forum.multicommander.com/forum/index.php/topic,1197.msg4124.html#msg4124

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/datetime

// http://forum.multicommander.com/forum/index.php/topic,4094.0.html

// ---------------------------------------------------------
@var $now = GetTime();
@var $date = FormatDate( "yyyy-MMm-dd" , $now );
@var $time = FormatTime( "HH-mm" , $now );

@var $folder;
@var $FolderBaseName = GetSourcePath();

// ---------------------------------------------------------
// Ask user for folder name
@var $answer = AskText("Type name of the new folder to create.", "backup", 0);

// If user canceled, abort
if ( $answer == 0 )
{
break;
}

$folder = $FolderBaseName ^ ($answer + "_" + $date + "_" + $time);

MC.Filesystem.Makedir PATH={$folder}

// ---------------------------------------------------------

Title: Re: create a new open folder with the current date
Post by: mlabrkic on February 20, 2022, 19:20:33
also tested    ;)
(Format Date and Time + Ask user for folder name)


Code: [Select]
// MC_Create_folder_your_input_and_date_format, F12

// MultiCommander script: Create a new folder (your input, current date and time, format)
// 2022-02M-20 18:55:27

// ---------------------------------------------------------
@var $now = GetTime();

@var $folder;
@var $FolderBaseName = GetSourcePath();

// ---------------------------------------------------------
// @var $date = FormatDate( "yyyy-MM-dd" , $now );

@var $year = FormatDate( "yyyy" , $now );
@var $month = FormatDate( "MM" , $now );
@var $day = FormatDate( "dd" , $now );

@var $date = $year + "-" + $month + "M-" + $day;

// ---------------------------------------------------------
// @var $time = FormatTime( "HH-mm" , $now );

@var $hours = FormatTime( "HH" , $now );
@var $minutes = FormatTime( "mm" , $now );

@var $time = $hours + "h-" + $minutes;

// ---------------------------------------------------------

// Ask user for folder name
@var $answer = AskText("Type name of the new folder to create and move selected files.", "backup", 0);

// If user canceled, abort
if ( $answer == 0 )
{
break;
}

$folder = $FolderBaseName ^ ($answer + "_" + $date + "_" + $time);

MC.Filesystem.Makedir PATH={$folder}

// ---------------------------------------------------------