Skip to content
Snippets Groups Projects
Commit 510b531f authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Do the right thing for HTTP files when --delete_downloaded and/or

--cleanup is specified on the command line.
parent 876ad53a
No related branches found
No related tags found
No related merge requests found
......@@ -483,12 +483,26 @@ sub fetch_files {
} elsif ( $uri->scheme() eq 'http' ) {
# Deal with HTTP files.
my $ua = LWP::UserAgent->new();
$ua->env_proxy();
my $file_path =
catfile( $dest_dir, basename( $uri->path() ) );
if ( $deletedownloaded && -f $file_path ) {
printf( "Deleting '%s'\n", $file_path );
unlink($file_path);
}
if ( $checkdownload && -f $file_path ) {
# The file is already there, no need to connect to a
# HTTP server.
printf( "File '%s' already exists\n", $file_path );
push( @processed_files, $file_path );
next;
}
my $ua = LWP::UserAgent->new();
$ua->env_proxy();
if ( !-d dirname($file_path) ) {
printf( "Creating directory '%s'\n",
dirname($file_path) );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment