Search notes:

Perl module File::Path

use warnings;
use strict;

use File::Path qw(rmtree make_path);

if (-d 'TestRmTreeDir') {
  print "removing TestRmTreeDir\n";
  removeDirectory();
}
else {
  print "creating TestRmTreeDir\n";
  createDirectory();
}

if (-d 'recursive/directory') {
   print "removing recursive/directory\n";
   rmtree 'recursive/directory'; 
}
else {
   print "creating recursive/directory\n";
   make_path 'recursive/directory'; # Emulate mkdir -p with make_path
}


sub removeDirectory {
  rmtree 'TestRmTreeDir';
}

sub createDirectory {

  mkdir 'TestRmTreeDir';
  
  open (my $fh, '>', 'TestRmTreeDir/File.txt') or die;
  
  print $fh 'Some text goes into the file';
  
  close $fh;

}
Github repository PerlModules, path: /File/Path/script.pl

See also

Perl modules.
Perl function: mkdir

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759391597, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/File/Path/index(79): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78