Sponsored Content
Top Forums Shell Programming and Scripting FTP script to login and list files to log file Post 302350821 by voorhees1979 on Saturday 5th of September 2009 03:24:54 PM
Old 09-05-2009
SOLVED FTP script to login and list files to log file

Hi Guys

I did a forum search for "ftp scripts" Looked at 8 pages and didnt see anything that would help. Most seem to be logging into a ftp server and transfering files.

What I need to do is login to a FTP server. Goto a folder and list it so it showes newest files first. It would be nice to set it to show only the last 10 newest but it doesnt matter if it's all. The said FTP server is an Amiga server for abandonware games so sometimes there can be alot.

The script I came out with is as follows:

Code:
#!/bin/bash
lftp -p 21 -u anon,anon site/amiga
ls -lat &> /home/voorhees/scripts/ftp.log
exit
leafpad /home/voorhees/scripts/ftp.log

But as soon as anyone see's this they will know it won't work Smilie

What happens is is it logs into the server fine it goes to the amiga folder then just sits there.

It doesnt even matter if it doesnt log to a file as the script runs this in a terminal so I can actually see the output anyway. I would prefer it to log the txt for the last 10 newest entries then open the log file afterwards.

Any help would be great. Thanks for reading.

Last edited by voorhees1979; 09-05-2009 at 06:26 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP Script with hidden login name and Password

hi, i need a method to hide the login name and password ....during FTP ....in the script.. thnks (3 Replies)
Discussion started by: scorpiyanz
3 Replies

2. Shell Programming and Scripting

Reading list of files into ftp script

How can I go about getting this done? I have tried and failed with a loop before I start the session and after seeing that I am already in the ftp code block and not bash when I am trying to perform this: #FTP Information ftp_server=xx.xxx.xxx.xx ftp_user=xxxx while read line; do... (1 Reply)
Discussion started by: BkontheShell718
1 Replies

3. Shell Programming and Scripting

Pulling a list of files from FTP site in a shell script

Hi, I am writting a shell script which will pull a list files (mentioned in one file 1.txt) from external FTP site (for ex: ftp://abcd.efghijk.com/). The 1.txt is in my local unix directory. I have username and password to connect the external FTP site. Also before I pull the files, I need... (0 Replies)
Discussion started by: spatra
0 Replies

4. Shell Programming and Scripting

Getting a list of files on an ftp, via shell script...

G'day, I was wanting to write a shell script that checks an ftp server for the presence of new files, then get those files. In so much as the get, this is pretty straight forward, but I cannot work out how to get a list of files to check. Is it possible for a shell script to get the output of... (1 Reply)
Discussion started by: Elric of Grans
1 Replies

5. Shell Programming and Scripting

List files ftp

I list files on server ftp, and i'm a french man then i have files with accents. When i use wget for a mirroring, the files with accent are not encoded correctly, i have some "%CC%81" instead "é" for example... I have idea to cat the file list and pipe for tr awk or sed but unfotunately nothing... (2 Replies)
Discussion started by: protocomm
2 Replies

6. Shell Programming and Scripting

ftp script : list 4 lasts files

Hi, At work we have backups on a ftp. I want to view 4 last files saved (their names, dates, and weight). how can i achieve this goal using simplest way ? Thank's. (3 Replies)
Discussion started by: simon974
3 Replies

7. Solaris

FTP log only shows FTP LOGIN FROM entry?

OS: Solaris 9 Configuration /etc/syslog.conf daemon.debug /etc/inetd.conf ftp stream tcp6 nowait root /usr/sbin/in.ftpd in.ftpd -A -l -d Found the ftp.log only generate those entries from other servers/hosts. Can we trace on all ftp entries either from/to the server? ... (6 Replies)
Discussion started by: KhawHL
6 Replies

8. Shell Programming and Scripting

FTP to list files

Hi Guys, Am writing a FTP script to download file from a remote server. There are 3 files in the target directory. eg. bfg234.2 vfg345.1 abc123.1 abc123.2 I need to get the file "abc123.2". The number could be increasing everytime.I need to get the latest file. can this be done ? (1 Reply)
Discussion started by: giri_luck
1 Replies

9. Shell Programming and Scripting

Doubt in .netrc file for ftp login

Hi, i have a doubt. i am using .netrc file for login to a ftp server. ftp abc.ftp.com suppose i have 2 userid and password for the same server as shown below. which one is it going to read from the .netrc file? cat .netrc machine abc.ftp.com login admin1 password pass1 machine... (13 Replies)
Discussion started by: Little
13 Replies

10. UNIX for Advanced & Expert Users

Help with a shell script? List files, delete them and log them

Hello, i'm trying to solve this script. List, one at a time, all files larger than 100K in the /home/username directory tree. Give the user the option to delete or compress the file, then proceed to show the next one. Write to a logfile the names of all deleted files and the deletion times. I... (7 Replies)
Discussion started by: jose2802
7 Replies
FTPUSERS(5)						     Linux Programmer's Manual						       FTPUSERS(5)

NAME
ftpusers - list of users that may not log in via the FTP daemon DESCRIPTION
The text file ftpusers contains a list of users that may not log in using the File Transfer Protocol (FTP) server daemon. This file is used not merely for system administration purposes but for improving security within a TCP/IP networked environment. It will typically contain a list of the users that either have no business using ftp or have too many privileges to be allowed to log in through the FTP server daemon. Such users usually include root, daemon, bin, uucp, and news. If your FTP server daemon doesn't use ftpusers then it is suggested that you read its documentation to find out how to block access for certain users. Washington University FTP server Daemon (wuftpd) and Professional FTP Daemon (proftpd) are known to make use of ftpusers. Format The format of ftpusers is very simple. There is one account name (or username) per line. Lines starting with a # are ignored. FILES
/etc/ftpusers SEE ALSO
passwd(5), proftpd(8), wuftpd(8) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2000-08-27 FTPUSERS(5)
All times are GMT -4. The time now is 12:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy