#/bin/perl/ use strict; use warnings; use File::Path qw(make_path); my @structs; my $structs; my @molecs; my $molecs; my @steps; my $steps; # Parent structure directory. @structs = ( dir_tree( 'struct', 7, 1, 1), dir_tree( 'struct', 7, 2, 2 ), # dir_tree( 'struct', 7, 3, 3 ), # dir_tree( 'struct', 7, 4, 4 ), # dir_tree( 'struct', 7, 5, 5 ), # dir_tree( 'struct', 7, 6, 6 ), ); # Subfolder molecule directory. @molecs = ( dir_tree( 'AB', 6, 1, 1 ), dir_tree( 'BC', 6, 1, 1 ), # dir_tree( 'XZ', 6, 1, 4 ), # dir_tree( 'XY', 6, 1, 4 ), # dir_tree( 'QU', 6, 1, 4 ), # dir_tree( 'QE', 6, 1, 4 ), ); # Subfolder steps directory. @steps = ( dir_tree( 'S', 6, 1, 2 ), ); for $structs (@structs) { make_path "/media/RAIDstorage/home/results/$structs"; } for $molecs (@molecs) { for $steps (@steps) { make_path "/media/RAIDstorage/home/results/$structs/$molecs/$steps"; } } # Define subroutine here. sub dir_tree { my ( $name, $total_length, $from, $to ) = @_; my $length = $total_length - length($name); my $format = "${name}%0${length}d"; return map sprintf( $format, $_ ), $from .. $to; }