Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Monday, October 31, 2011

Perl mkdir, make_path and mkpath

mkdir can only create directories in directories that already exist. So if you say

mkdir("c:\\season1\\unearthly\\ep1\\caps");

it will only work if directory c:\season1\unearthly\ep1 already exists.

File::Path::make_path() will create a directory and any necessary ancestor directories (must use mkpath() instead on Perl 5.10 and possibly other versions earlier than 5.14).

NB it's File::Path:: not File::Path-> - the latter will give you a misleading error "mkdir File::.: Invalid argument; The filename, directory name, or volume label syntax is incorrect" .

Followers

Blog Archive