Link to home
Start Free TrialLog in
Avatar of bje
bjeFlag for United States of America

asked on

List files on a FTP or SFTP server and get only the files in the list

I have some FTP and SFTP scripts that do a mget to pull files, however need to list files on the FTP/SFTP server and only pull those files in the list or certain files in the list?

Any examples would be helpful.

Thanks.
Avatar of MikeOM_DBA
MikeOM_DBA
Flag of United States of America image

Try something like:
ftp -n -v $REMOTSERVER << eof > FileList.txt
user $FTPUSR $FTPPASSWD
cd $FTPDIR
dir MyFiles*
eof
#---- Now you have the names in "FileList.txt"
# 

Open in new window

You can just oportunistically fetch files with wildcards you need..
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bje

ASKER

Thanks for all the solutions