簡體   English   中英

Perl LWP :: Simple :: getstore如何檢查文件是否在目標目錄中

[英]Perl LWP::Simple::getstore How to check if the file exists in destination directory

在我的Perl腳本中,我使用LWP::Simple::getstore檢索圖像並將其存儲為文件。 但是在存儲之前如何檢查該文件是否已經存在?

這是片段

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); 

請幫我解決一下這個。

謝謝

您可以使用文件測試 ,例如

unless (-e $image_path) {
    LWP::Simple::getstore($image_url, $image_path); 
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM