![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to retrieve original contents of a modified file (modified using vi) | novice100 | UNIX for Dummies Questions & Answers | 3 | 05-31-2007 08:50 PM |
| chmod command for recently modified files | polka_friend | UNIX for Dummies Questions & Answers | 2 | 08-30-2006 03:25 PM |
| who modified my file!! | mohanprabu | UNIX for Dummies Questions & Answers | 4 | 10-28-2005 10:18 PM |
| File last modified | szzz | High Level Programming | 4 | 11-05-2003 11:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
ftp most recently modified file
Hi what is the most optimum way to ftp the most recently modified file starting with a particular string.
i tried this Code:
ftp -n 2>logfile 1>&2 <<EOF
open xxxxxx
user xxxx xxxx
prompt
ls -ltr f* res
!var=`tail -1 |awk { print $9 }'`
bye
EOF
|
|
||||
|
here is what i could find the best. Please suggest me better ways than this:
Code:
for filename in `cat filelist` ; do
export file=`rexec remote_server ls -t ${filename}* | head -1`
echo "THE FILENAME IS" $filename
ftp -n <<-EOF
open bdwux001
user xxxxx xxxxxxx
mget $file
bye
EOF
echo "END"
done
Last edited by ahmedwaseem2000; 02-27-2007 at 11:05 AM.. |
|
|||||
|
You seem to reject my technique without commenting on it. If your script is working I guess it's good enough. But you are depending on the rexec protocol being enabled and often it is not available. You also use one ftp process per file. If you switch to a ksh coprocess, a single ftp process is enough for the entire job.
|
|
||||
|
Quote:
I am not aware of coprocess could you please explain it?? THANKS FOR ALL YOUR HELP AND EFFORTS TO HELP ME AND ALL OTHERS IN THE FORUM. |
|
|||||
|
A coprocess is setup by:
command |& Then "print -p" sends stuff to the coprocess as standard input and "read -p" gets stuff back from the coprocess' standard output. This only works with ksh and it is documented on the ksh man page. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|