Sponsored Content
Full Discussion: download files
Top Forums Shell Programming and Scripting download files Post 302258836 by imad77 on Sunday 16th of November 2008 07:51:11 AM
Old 11-16-2008
download files

Hi,
I experience some difficulties to perform a script to be able to download some files via HTTP.

The Perl script is located on a Linux in a server ("/var/www/cgi-bin/down.pl") where I can run it via Internet Explorer.

I'm able to display the directory content ("/home/toto") but I'm not able to open or save the files from this directory to my local machine (Windows XP by example).

My goal is to be able to save a file when I click on them and choose the target on my local machine.

Can someone help me to fix this script? thanks in advance.

Code:
#!/usr/bin/perl
use CGI;
$|=1;
my $query=new CGI;
print qq~
<table align="center" width="90%">
<tr><td><font color="black" face="Arial" size="4"><b>Files in current directory</b></td></tr>
<tr>
<td valign="top">
<font color="black" face="Arial" size="2">
~;
$dir="/home/toto";
opendir(DIR, "$dir");
@current = readdir(DIR);
closedir(DIR);

foreach(@current){
unless($_ eq '.' || $_ eq '..' || -d qq~$dir/$_~){
push(@currentfiles, $_);
}
}
@currentfiles = sort { uc($a) cmp uc($b) } @currentfiles;
for($aa = 0; $aa <= $#currentfiles; $aa++){
print qq~

<a href="$dir/$currentfiles[$aa]" target="_blank">$currentfiles[$aa]</a><a href="$dir/$currentfiles[$aa]"> </a></font><br>
~;
}
print qq~
</font></tr>
</table>


Last edited by otheus; 03-08-2009 at 12:42 PM.. Reason: code tags added
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shellscript for download files

Hi, iam new to shell script how to download files from one Linux box to other Linux box folder. example : Box1: folder---/home/test/* Box2:folder---/home/download/ using FTP shellscript..? Thanks lot. Ram (3 Replies)
Discussion started by: ram2s2001
3 Replies

2. UNIX for Dummies Questions & Answers

Download files using perl

What is the easiest way to download some file using perl for it. (2 Replies)
Discussion started by: mirusnet
2 Replies

3. Shell Programming and Scripting

script for download files from ftp site

I'm new to scripting. I'm trying to write a script to download files from ftp site, the following is the script and the message i get after running the script. no files were downloaded :( Thanks advance! script: #!/usr/bin/ksh DAY=`date --date="-1 days" +%y%m%d` ftp -v -n "ftp.address" <<... (5 Replies)
Discussion started by: tiff-matt
5 Replies

4. Linux

shell script to download files from a site?

Hey everyone, my wife has purchased a bundle package of a bunch of images from a site, and now has to download each one of them manually. There are about 500 downloads, and it's quite a hassle to browse to each page and download them all individually. I would like to write a shell script to... (2 Replies)
Discussion started by: paqman
2 Replies

5. Shell Programming and Scripting

shell script to download variables files

Hello all i am working on creating shell script to download files daily example : file12_10_2009.txt.gz next day this file will be file13_10_2009.txt.gz and so on.. i need help to know how to download this incrimental date files daily ? regards (1 Reply)
Discussion started by: mogabr
1 Replies

6. Shell Programming and Scripting

LFTP - to download files that are between 0 and 3 days old

Im writing a script and i specifically need it to download files that are between 0-2 days old. This will run every 2 days. I understand lftp supports newer files only, but these files will be removed from the target so this is not what we want. Does anyone know how to do this? ----------... (0 Replies)
Discussion started by: mokachoka
0 Replies

7. UNIX for Advanced & Expert Users

Help with using curl to download files from https

Hi I'm trying to download an xml file from a https server using curl on a Linux machine with Ubuntu 10.4.2 I am able to connect to the remote server with my username and password but the output is only "Virtual user <username> logged in". I am expecting to download the xml file. My output... (4 Replies)
Discussion started by: henryN
4 Replies

8. Shell Programming and Scripting

Files download using wget

Hi, I need to implement below logic to download files daily from a URL. * Need to check if it is yesterday's file (YYYY-DD-MM.dat) * If present then download from URL (sample_url/2013-01-28.dat) * Need to implement wait logic if not present * if it still not able to find the file... (1 Reply)
Discussion started by: rakesh5300
1 Replies

9. Shell Programming and Scripting

Download files every one second using ftp script

Our main Server "Srv1" is used to generate text files based on specified criteria and it is also connected to two clients (pc1 and pc2) which are responsible for getting the files from Srv1 as it follows: 1. pc1 ( which represents my UNIX machine ) uses shell script to copy the files from Srv1 2.... (3 Replies)
Discussion started by: arm
3 Replies

10. UNIX for Dummies Questions & Answers

List and download web page files

Hello, Does anyone know of a way to list all files related to a single web page and then to download say 4 files at a time simultaneously until the entire web page has been downloaded successfully? I'm essentially trying to mimic a browser. Thanks. (2 Replies)
Discussion started by: shadyuk
2 Replies
AUTOCONF(1)						      General Commands Manual						       AUTOCONF(1)

NAME
autoconf2.13 - creates scripts to configure source code packages using templates SYNOPSIS
autoconf2.13 [ --help | -h ] [ --localdir=dir | -l dir ] [ --macrodir=dir | -m dir ] [ --version ] DESCRIPTION
To create configure from configure.in, run the autoconf2.13 program with no arguments. autoconf2.13 processes configure.in with the m4 macro processor, using the Autoconf macros. If you give autoconf2.13 an argument, it reads that file instead of configure.in and writes the configuration script to the standard output instead of to configure. If you give autoconf2.13 the argument -, it reads the standard input instead of configure.in and writes the configuration script on the standard output. The Autoconf macros are defined in several files. Some of the files are distributed with Autoconf; autoconf2.13 reads them first. Then it looks for the optional file acsite.m4 in the directory that contains the distributed Autoconf macro files, and for the optional file aclo- cal.m4 in the current directory. Those files can contain your site's or the package's own Autoconf macro definitions. If a macro is defined in more than one of the files that autoconf2.13 reads, the last definition it reads overrides the earlier ones. autoconf2.13 accepts the following options: --help -h Print a summary of the command line options and exit. --localdir=DIR -l DIR Look for the package file aclocal.m4 in directory DIR instead of in the current directory. --macrodir=DIR -m DIR Look for the installed macro files in directory DIR. You can also set the AC_MACRODIR environment variable to a directory; this option overrides the environment variable. --version Print the version number of Autoconf and exit. SEE ALSO
autoheader2.13(1), autoreconf2.13(1), autoscan2.13(1), autoupdate2.13(1), ifnames2.13(1) AUTHORS
David MacKenzie, with help from Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, Roland McGrath, Noah Friedman, David D. Zuhn, and many others. This manpage written by Ben Pfaff <pfaffben@debian.org> for the Debian GNU/Linux autoconf2.13 package. Autoconf AUTOCONF(1)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy