Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP - Command line restriction

Status
Not open for further replies.

bharix

Programmer
Aug 6, 2002
23
DE
guys,

take a look at this code snipette,

ftp -ivn <<! >> $LOG_TMP 2>&1
open $FTP1_SRV
user $FTP1_USR $FTP1_PAS
cd $FTP1_BDIR
cd $ADIR
mdel $(< ff.$$)
bye
!

Here the file ff.$$ can have MANY file names which sometimes exceeds the command line length and thus FTP just ignores addional characters.

How can I avoid this from happening?
- I want to avoid multiple FTP connections (no loop)
- I am going to do 'man split' but are there any better ways to handle such a situation?

TIA,
bharix
 
You could replace

mdel $(< ff.$$)

with

$(sed 's/^/mdel /' ff.$$)

Of course, a simple 'del' would work if there aren't any wildcards in ff.$$.



Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Something like this ?
(echo "open $FTP1_SRV
user $FTP1_USR $FTP1_PAS
cd $FTP1_BDIR
cd $ADIR"
cat ff.$$
echo bye
) | ftp -ivn >> $LOG_TMP 2>&1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
RodKnowlton -
ff.$$ has space deliminated filenames.
fname1.txt fname2.txt ... fnamen.txt

$(sed 's/^/mdel /' ff.$$)
produces:
mdel fname1.txt fname2.txt etc

so I should be replacing SPACE with CR+mdel

Thanks for your inputs, now I am thinking on correct lines.

bharix.
 
Oops, hit the submit button too fast ;~/
(echo "open $FTP1_SRV
user $FTP1_USR $FTP1_PAS
cd $FTP1_BDIR
cd $ADIR"
for f in $(<ff.$$); do echo "del $f"; done
echo bye
) | ftp -ivn >> $LOG_TMP 2>&1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
yes, PHV now thats making more sense.

Thanks much for quick help.

bharix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top