Help for this page

Select Code to Download


  1. or download this
    my(@filenames, $directory);
    opendir($directory, $directory_path)
        or die "opendir of $directory_path failed: $!\n";
    @filenames = grep /\A\d+\.jpg\z/, readdir($directory);
    closedir($directory);
    
  2. or download this
    use File::Spec;
    -d $subdir_path
        or mkdir($subdir_path, 0777)
            or die "mkdir of $subdir_path failed: $!\n";
    rename($filename, File::Spec->catfile($subdir_path, $filename))
        or die "rename of $filename failed: $!\n";
    
  3. or download this
    use File::Spec;
    
    for my $directory_path (@ARGV) {
    ...
    
        }
    }