Re: Get the most recent file in a remote server using FTP script
- From: "johngnub" <johngnub@xxxxxxx>
- Date: 26 Sep 2006 16:28:40 -0700
Silly question:
Most ( not all ) the ftp shells can do a ls -l "ftp> ls -l" , collect
the info, then do your head/tail,
, Like a 2 pass setup, a) get list, b) read list, c) do more work.
2 cents. JB
Lie-Algebra wrote:
anujairaj a écrit :
Hi,
I have a few files with a timestamp appended in the end ,in a remote
server,I need to get the most recent one in the ftp scripot.But Iam
unable to do it using :
MOST_RECENT_FILE1=`ls -1t ${FTP_OUTPUT_DIR}${FTP_OUTPUT_FILE1}* | head
-1 `
get ${MOST_RECENT_FILE1} ${FTP_INPUT_DIR}${FTP_INPUT_FILE1}.csv
it says,file not found.
Can anyone help me on this?
thanks
Hi,
this cant work, the output of the command ls -lt * | head -1 would
consist of a line such as the following :
-rwxr-xr-x 1 user group 748 2006-09-23 12:57 mostRecentFile
To catch the filepath(relative to the rep you are in), you need to pipe
the previous output to obtain something like : ls -lt * | head -1 | awk
'{print $NF}'
I guess you could play with the echo command in your ftp script to see
if the result is relevant to you.
Hope this help.:)
.
- References:
- Get the most recent file in a remote server using FTP script
- From: anujairaj
- Re: Get the most recent file in a remote server using FTP script
- From: Lie-Algebra
- Get the most recent file in a remote server using FTP script
- Prev by Date: Filesystem usage by Directory wise
- Next by Date: How to get argv[0] in alias for bashrc
- Previous by thread: Re: Get the most recent file in a remote server using FTP script
- Next by thread: Filesystem usage by Directory wise
- Index(es):
Relevant Pages
|