Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Copy

Status
Not open for further replies.
Joined
May 21, 2002
Messages
19
Location
US
I need to add to a script a line that will copy a file from the cgi-bin directory to a directory that has been created by the script. Can someone help with this?
 
I take it from the lack of replies that this is not possible.
 
Certainly it is possible, not only possible but trivial also.
Code:
#!/usr/local/bin/perl 
use CGI;
use CGI::Carp "fatalsToBrowser";
use strict;
my $o = new CGI;
print $o->header, 
      $o->start_html,'<p>';

unless (mkdir JUNK, 777) { die &quot;Failed mkdir, $!\n&quot;; }
open(OPF,&quot;>./JUNK/SomeFile.txt&quot;) or die &quot;Failed open, $!\n&quot;;
print OPF &quot;Content for new file\n&quot;;
close OPF;

print 'Successfully wrote to new file</p>',
      $o->end_html;
'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top