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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For loop & FTP

Status
Not open for further replies.

dsm325

Technical User
Apr 4, 2001
29
0
0
US
Need advice on how to do this.
I have several Excel files with long names that I need to FTP to a shared server. The only thing that's unique about these files is the word ltd, some have std, and some have waiver as part of the file name. Now there are about 16 files like that. How do I create a for loop, that will check for file name with std do ftp and how do I call the ftp command.
Thanks so much
 
dsm,

If you can use Perl then the Net::FTP module will be very useful to you. Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
You could do something like this.

STD=$(ls -l |nawk '{print $9}'|grep -i "std")
for files in $STD
do
then your ftp commands here.

You may want to make your ftp seesion a function in your script, and just call the function in your for loop. This is the way I have mine. It works better and it is easier to read.
 
Mike and siswjh thanks much for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top