Author Topic: Create a folder and go to it  (Read 13666 times)

herve

  • Junior Member
  • **
  • Posts: 17
    • View Profile
Create a folder and go to it
« on: November 29, 2017, 08:54:43 »
Hello,

Can I suggest a new feature, create a folder and go inside it after it has been created ?

Bye,
Hervé

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 534
  • Old Skull
    • View Profile
Re: Create a folder and go to it
« Reply #1 on: November 29, 2017, 09:08:26 »
MC already supports it. There're at least 2 ways:

1. pressing Ctrl+Enter in "Create new folder dialog";
2. specifying GOTO param for Custom command "MC.Explorer.Makedir".

herve

  • Junior Member
  • **
  • Posts: 17
    • View Profile
Re: Create a folder and go to it
« Reply #2 on: November 29, 2017, 09:09:58 »
Thank you very much.

pncdaspropagandas

  • Contributor
  • Active Member
  • *****
  • Posts: 93
    • View Profile
Re: Create a folder and go to it
« Reply #3 on: December 06, 2017, 11:50:32 »
I also find very useful moving selected files to a new Folder. So I scripted it and mapped to SHIFT+F8:

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

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

// Folder exists?
@var $source_path = GetSourcePath();
if( FileExists($source_path ^ $answer) > 0 )
{
MessageBox("Error", "Typed folder already exists.", 0);
break;
}
else
{
// Create empty folder
// Check if source path is LOCAL
@var $options;
if( IsFolder($source_path) )
{
@var $colon_check = StrSub($source_path, 1, 1);
if( StrIsEqual($colon_check, ":") )
{
$options = "LOCAL,RECURSIVE";
}
else
{
$options = "";
}
}
else
{
$options = "";
}

if( MakeDir($source_path ^ $answer, $options) == 0 )
{
Log( 1, 10, "Created : " + $source_path ^$answer );
@var $selected_files = GetSourceSelectedPaths();
@var $n;
@var $len = StrLen($answer) - 1;
@var $slash = StrSub($answer, $len, 1);
if( StrIsEqual($slash, "\\") )
{
$slash = "";
}
else
{
$slash = "\\";
}
for( $n=0; $n<arrayCount($selected_files); $n++ )
{
// MoveFile has a bug where target path has to end with slash
if( $n == 0 )
{
MoveFile($source_path ^ $answer + $slash, $selected_files[$n], "NOWAIT,NODIALOG,NEWQUEUE");
}
else
{
MoveFile($source_path ^ $answer + $slash, $selected_files[$n], "NOWAIT,NODIALOG,USEEXISTINGQUEUE");
}
}

// Select created folder
//SetClipboardText($source_path ^ $answer);
//MC.RunCmd ID="Core.1312"
//MC.Explorer.Selection.UnselectAll
}
else
{
MessageBox("Error", "Error while creating folder.", 0);
break;
}
}