#!/usr/bin/perl require 5.6.1; use strict; use warnings; die "Usage: listseq.pl [min] \n" unless (@ARGV >= 2 and @ARGV <= 3); # Retrieve the URL my $extract = shift; # Sort out the range of numbered files we should be getting my $min; if (@ARGV >= 2) { $min = shift; } else { $min = 1; } my $max = shift; # Separate the path from the filename and save both $extract =~ /^(\S*\/)(\S*?)$/; my ($filepath, $filename) = ($1, $2); # Pull the filename and extension from the file; determine precision (1 vs 01) $filename =~ /^(\S+?)(\d+)(\.\S+)$/; my ($name, $numlength, $extension) = ($1, length($2), $3); # Print the list of filenames for (my $i = $min; $i <= $max; $i++) { print ($filepath, $name, (sprintf "%0${numlength}d", $i), $extension, "\n"); }