diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-11-12 14:54:21 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-11-12 14:54:21 +0100 |
| commit | 769dcb273179dfc4dcd3ad363c6490f1e1bfb517 (patch) | |
| tree | acc23b9d44b9500d45d3913b67ed3390c29732b3 /dir-to-movie.pl | |
| parent | 9584b48162b846992025be3ffbd4674ad48b531a (diff) | |
fixing sequence script
Diffstat (limited to 'dir-to-movie.pl')
| -rwxr-xr-x | dir-to-movie.pl | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/dir-to-movie.pl b/dir-to-movie.pl index 5bcb738..aff33d6 100755 --- a/dir-to-movie.pl +++ b/dir-to-movie.pl @@ -20,6 +20,19 @@ GetOptions ( ) or die("Error in command line arguments\n"); +sub read_dir { + my $path = shift; + my $files = []; + opendir my $dir, $path or die "Cannot open directory: $!"; + while (my $file = readdir($dir)) { + if ($file =~ /\.png$/) { + push @$files, $file; + } + } + closedir $dir; + return $files; +} + $tag =~ s/\....$//; print "tag: $tag\n"; @@ -34,8 +47,9 @@ if (! -e "$path/$tag") { chdir("$path/$tag"); my $i = 0; -my $ls = `ls -1v *.png`; -my @lines = split('\n', $ls); + + +my @lines = read_dir('.') my $pwd = `pwd`; chomp $pwd; $pwd .= '/'; @@ -43,7 +57,7 @@ print $pwd . "\n"; mkdir('./tmp'); -for my $line (@lines) { +for my $line (sort @lines) { if ($line !~ /$prefix/) { next; } |
