Hi Hazylife !

sorry for answering late ! Yes, sure, below you find the complete script.
It gets called with two parameters, the path and the name of the file to be downloaded

I left all the commented sections inside, they result from different approaches
to the function or they were meant to provide information
of what the script was receiving and doing with it.

Having downloaded the file, the source directory gets removed.
Finally the script calls a defined URL to return to

Thanks for your efforts !

Cheers
Uli

#!/usr/bin/perl #use warnings; # open (datei, "<liste.txt"); # $verzeichnis=<datei>; # close datei; $Datten = $ENV{'QUERY_STRING'}; @Daten=split(/&/, $Datten); @dateien=split(/=/, @Daten[0]); @verz=split(/=/, @Daten[1]); $verzeichnis = @verz[1]; # print "Content-type: text/html\n\n"; # # print $Datten."<br>\n"; # print @Daten."<br>\n"; # print @dateien."<br>\n"; # print @verz."<br>\n"; # print $verzeichnis."<br>\n"; # print @dateien[1]."<br>\n"; # exit; download($verzeichnis, @dateien[1]); # $url = $verzeichnis.@dateien[1]; # print "Location: $url\n\n"; wait(); use File::Path qw( rmtree ); rmtree( $verzeichnis ); # Verzeichnisse in downloads, ‰lter as 1 Tag lˆschen # opendir(zeig,'../downloads/./'); # @entries = readdir(zeig); # close zeig; opendir zeig, '../downloads/./'; while ($entry = readdir zeig){ push (@entries, $entry); } #$index=-1; open (file, ">", "aktion.txt"); print file @entries; foreach $entry (@entries) { #$index++; print file $entry."\n"; if ($entry ne '.' && $entry ne '..' && $entry ne "index.html") { if(-d "../downloads/$entry") { if ((-M "../downloads/$entry") >1 ) { rmtree( "../downloads/$entry" ); print file " wurde gelöscht\n"; } } } } close (file); open (datei,">","fertig.txt"); print datei "Nachhause.pl !"; close datei; # $status=""; # $status=system("../cgi-bin/nachhause.pl","../donwloads/index.html"); # # wiederwarten: # unless ($status ne "") { # goto wiederwarten; # } heimat(); exit; sub download { use CGI; $html=new CGI; #print $html->header(-type => 'application/octet-stream', -attachment +=> $_[1]); print $html->header(-type => 'application/zip', -attachment => $_[1]); + open($peunter, "<", $_[0].$_[1]); binmode($peunter); binmode STDOUT; while (read($peunter,$bytes,1024)) { unless (eof()) { #unless (length($bytes)<1024) { chomp($bytes); } print $bytes; } #@data = <$peunter>; close($peunter); #print "@data"; } sub heimat { # use CGI; # # $htm=new CGI; # print $htm->header(-type =>'text/html', -expires => 'now'); # print $htm->system("../cgi-bin/nachhause.pl","../donwloads/index.htm +l"); $- =0; system("../cgi-bin/nachhause.pl","../donwloads/index.html"); }

In reply to Re^4: CRC Error on ZIP Files by SearchigPerl
in thread CRC Error on ZIP Files by SearchigPerl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.