Connect to FTP find files and export them to another server

Hi

I'm trying to make script that will connect to FTP Server than find files that contain word HIGH in name and than export them to another server. Can anyone tell me if something like this is possible?

Thanks :slight_smile:

Yes, it's possible.

What have you tried and where are you having problems?

I tried to connect to FTP with code

#! /bin/bash

#FTP connection
HOST="ftpconnect.com"
USER="user"
PASSWD="password"


ftp -n $FTP_SRV <<END_SCRIPT
quote USER $HOST
quote PASS $FTP_PSW

quit
END_SCRIPT

but it cant connect. Can anyone help me solve this?

In what way does it not work?

It cant connect to server. Maybe there are some other solution that could be used for connecting to server?

---------- Post updated at 07:22 AM ---------- Previous update was at 05:50 AM ----------

I managed to connect using this code

ssh user@something.com

I want to when is connected to FTP to copy files from folder /data/*HIGH*.7z (i don't know if this is written correctly. I want to copy all files from data Folder that have word HIGH in name) and copy them to another server.

If the server isn't actually running an FTP server, you won't be able to connect to it with FTP.

If you can connect with ssh, perhaps you can copy with scp:

scp /data/*HIGH*.7z username@host:/path/to/destination

If you want it to happen passwordlessly, you will need to arrange shared keys in advance, because ssh will not let you force it to read a password from a script.

This isn't working. I'm realy confused now :frowning:

Can i somehow make batch file that will do this?

Moderator comments were removed during original forum migration.