I have a bash script to retrieve files from ftp.
Now the files have one part a date string in the filename, but also undefined numbers that changes on every file. I want
It sounds like you want to handle multiple files, but your script can only handle one file at a time. Furthermore, because you specified FTP, it sounds like the files are on the FTP server, in which case local filename expansion will not help.
You probably want to use the ftp client's mget
command to download multiple files matching a pattern on the remote side. You also want to include $TIMESTAMP
as part of the pattern. I'd suggest something like this:
ftp remote-hostname <
This uses a here-document (<
EOF
on a line by itself) to supply input text to the ftp commmand. It will expand the variable $TIMESTAMP
so it becomes part of the mget
command, e.g. if $TIMESTAMP was 12345, the ftp command will be told mget 123450???vel.radar.h5
.