I wrote a script in Perl to move images to a network share drive which works fine on a PC. When I try to run it on a Mac all I get are error messages. I can't figure out what is causing the problem. Would there be a reason the script won't run on the Mac? I'm using File::Copy and File::Find to move these files.
This is the error message I am getting:
copy failed:No such file or directory at "location of the script" line 14.
Any help would be great. Thanks. : )
use File::Copy;
use File::Find;
my @source = qw (source/location);
my $target = q{//share/drive/location};
while (1)
{ sleep (10);
find(
sub {
if (-f) {
print "$File::Find::name -> $target";
copy($File::Find::name, $target)
or die(q{copy failed:} . $!);
}
},
@source
);
}
Your //share/drive/location
is not valid on your Mac. That is why you get the no such file or directory
message.
You can test this in a terminal window by trying to cd
to that path.
That location will need to be mounted on your Mac so that you have a valid path to it.
That is done in your Finder or via the mount_smbfs command if you have a newer version of OSX.
Once that is done, you will have a path you can write to, such as /mnt/some/path
.