in reply to Variables with spaces and changing file extensions
For file names with spaces, wrap them with quotes. For example:use strict; use warnings; use File::Find::Rule;
As for your $list, I would eliminate that and call File::Find::Rule in list context like:my $itunes = '"/Volumes/Media/iTunes/iTunes Media/Automatically Add to + iTunes/"';
Here's how I would do it:my(@files) = File::Find::Rule
#!/usr/bin/perl use strict; use warnings; use File::Find::Rule; my $handbrake = '/usr/local/bin/HandBrakeCLI'; my $preset = 'AppleTV'; my $itunes = '"/Volumes/Media/iTunes/iTunes Media/Automatically Add to + iTunes/"'; my $tvtag = '/usr/local/bin/tvtag-sickbeard.pl'; my(@files) = File::Find::Rule ->file() ->name( qr/\.(mkv|avi)$/ ) ->in( @ARGV ); @files = join("\n", @files, ''); print "\nFound the following files to convert:\n\n@files\n"; foreach my $file(@files) { print $file . "\n"; system "$handbrake -i '{$file}' -o '$file.m4v' --preset=$preset"; }
|
|---|