Skip to content

Instantly share code, notes, and snippets.

@mishin
Last active December 19, 2015 07:49
Show Gist options
  • Save mishin/5920950 to your computer and use it in GitHub Desktop.
Save mishin/5920950 to your computer and use it in GitHub Desktop.
make dir on perl6
use v6;
BEGIN { @*INC.push( 'c:\Users\TOSH\Desktop\TCPU59\scripts\lib' );}
use File::HomeDir;
use File::Spec;
use DateTime::Format;
# use File::Directory::Tree;
main();
sub main {
my $work_path = File::HomeDir.my_home;
my $date = strftime( '%d%m%Y', DateTime.new(now) );
my $job_dir = File::Spec.catdir( $work_path, 'job', $date );
say $job_dir;
# mktree($job_dir);
# system ("mkdir $job_dir");
run "mkdir $job_dir";
my $file = File::Spec.catfile( $job_dir, $date ~'_nb.txt' );
if (my $fh = open $file, :w) {
$fh.say("hello world");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment