In my Perl script I am using LWP::Simple::getstore
to retrieve an image and store as file. But before storing how to check if that file already exists?
this is the snippet
use constant FILE_DIR => "/home/destination/files/";
my $image_path = FILE_FOLDER."$item_id"."_"."$file_date.$image";
my $res = LWP::Simple::getstore($image_url,$image_path);
Please help me with this.
Thanks
You can use a file test , eg
unless (-e $image_path) {
LWP::Simple::getstore($image_url, $image_path);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.