Sponsored Content
Full Discussion: Upload latest file to ftp
Top Forums Shell Programming and Scripting Upload latest file to ftp Post 302954388 by liviusbr on Monday 7th of September 2015 10:17:54 AM
Old 09-07-2015
Hi,


This is what I have tried :


Code:
LOCALBASE=/data/backups
SERVER=10.2.37.70
USER=test
PASSWD=test
INPUT=/data/backups/today.txt
FILETYPE=binary

## ftp put doesn't create directories by itself so
## we check for missing remote dirs, and create them

## upload the files
for ITEM in $(cat $INPUT); do
        FILE=$(basename $ITEM)
        ## ftp starts here
        ftp -v -n $SERVER <<END_OF_SESSION
        user $USER $PASSW
        $FILETYPE
        lcd $LOCALDIR
        cd $REMOTEDIR
        put $FILE
        bye
END_OF_SESSION
done


Last edited by vbe; 09-07-2015 at 11:23 AM.. Reason: code tags please
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to ftp latest file

Hello All, Hope u r doing fine. I'm writing a shell script to ftp the latest file having pericular convention as 'ULTI_15072007043205.txt' on daily basis. Now the date & timing of the file geleration isnt constant, so the file name daily varies as per the date & timing of generation. Can anyone... (7 Replies)
Discussion started by: im_new
7 Replies

2. UNIX for Dummies Questions & Answers

Getting latest file from ftp

Hi, i have multile JAMA01.DAT.* files in my ftp. how can i get the latest file in from the ftp by executing the script :rolleyes:? Regards, Arun S (3 Replies)
Discussion started by: arunavlp
3 Replies

3. UNIX for Dummies Questions & Answers

ftp command to get latest file

Hi, I would like an FTP command or series of commands to get only the latest file. Is that possible? Thanks in advance. (2 Replies)
Discussion started by: laiko
2 Replies

4. Shell Programming and Scripting

ftp the latest file from unix to windows

Hi, I have a ftp script to ftp files from unix to windows. Now i need to pull the latest file from unix to windows. It is not working. ftp -nvi $SERVER > ${FILE_DIR}/NavigationftpLog << EOD user $USER $PWD lcd $FILE_DIR echo "the local directory is $FILE_DIR" cd $Remote_PATH echo... (2 Replies)
Discussion started by: ammu
2 Replies

5. Shell Programming and Scripting

How to get latest file via FTP session

Hello , My requirement is as follows: I want to connect to a remote FTP server using FTP and then get the latest file from server location can u pls share code snippet for this ? Regards, Suresh (4 Replies)
Discussion started by: sureshg_sampat
4 Replies

6. Shell Programming and Scripting

ftp put in shell script -- whole file doesn't upload

Hi I'm having some trouble with a bash shell script that I'm writing. In the script, I'm trying to upload a file to a backup repository using ftp, but the whole file doesn't get uploaded. This is the file's properties at the start (I've highlighted the file size in red): -rw-r--r-- 1 root... (2 Replies)
Discussion started by: Viola
2 Replies

7. Shell Programming and Scripting

Question about how to ftp download the latest file from a directory

Dear all, Hope you are doing well. I am in trouble to write a shell for ftp downloading the latest file from remote server. Situation: There is a directory named 'weekly' which contains .csv files with the following pattern: RES_EN_100417-080003.csv.Z. The new file is generated... (3 Replies)
Discussion started by: kel1014
3 Replies

8. Shell Programming and Scripting

Curl ftp upload success but no file exist on the server !!!!

hello, I'm trying to upload a file to this ftp server and others ftp://ftp.byethost12.com as you can see in the output of CURL using the -v option curl reports that the upload succeeded but when i connected to the server with file-zilla there is no file uploaded the same command upload files... (5 Replies)
Discussion started by: laraaj
5 Replies

9. Shell Programming and Scripting

Script to upload latest file to other server via FTP

Hello, I have a script that finds the latest version of a file in a folder on my Minecraft server. I'm trying to come up with something that will then FTP that file over to my fileserver. Here's what I have that finds the newest file: find /home/mc/archive/sbhouse -type f -mtime +45 -exec... (7 Replies)
Discussion started by: nbsparks
7 Replies

10. Ubuntu

FTP script to get latest file from server

Hello people, I have to download, with a scheduled script, the latest file from an FTP server. In the remote DIR, named .../TEKNONET/60468/, every night a CDR file like this gets uploaded into it: 000006046820151122N001.CDR, so my script will have to download every day the previous day... (12 Replies)
Discussion started by: virtus96
12 Replies
Dancer::Request::Upload(3pm)				User Contributed Perl Documentation			      Dancer::Request::Upload(3pm)

NAME
Dancer::Request::Upload - class representing file uploads requests DESCRIPTION
This class implements a representation of file uploads for Dancer. These objects are accesible within route handlers via the request->uploads keyword. See Dancer::Request for details. METHODS
filename Returns the filename as sent by the client. basename Returns basename for "filename". tempname Returns the name of the temporary file the data has been saved to. This will be in e.g. /tmp, and given a random name, with no file extension. link_to Creates a hard link to the temporary file. Returns true for success, false for failure. $upload->link_to('/path/to/target'); file_handle Returns a read-only file handle on the temporary file. content Returns a scalar containing the contents of the temporary file. copy_to Copies the temporary file using File::Copy. Returns true for success, false for failure. $upload->copy_to('/path/to/target') size The size of the upload, in bytes. headers Returns a hash ref of the headers associated with this upload. type The Content-Type of this upload. AUTHORS
This module as been writen by Alexis Sukrieh, heavily based on Plack::Request::Upload. Kudos to Plack authors. SEE ALSO
Dancer perl v5.14.2 2011-11-30 Dancer::Request::Upload(3pm)
All times are GMT -4. The time now is 03:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy