This is regarding the get command to retrieve files (filename with wild card characters) from remote server.
I thought Get command can retrieve only 1 file irrespective of the files it has on the remote server And it is the function of mget to retrieve all files using wildcard.
this is the command I am using
get $remote_path/DOE*.txt $local_path
Here, all the files with DOE*.txt are retrieved.
Is there any way that I can get only the first file with the match and disconnect.
I don't think GET should retrieve multiple files. Perhaps you meant mget, which is a completely different command.
FTP is very simple and stupid. FTP doesn't have a "get first file and quit" option. You'd have to ls, process the list locally, then re-connect and GET the one specific file you want.
How do you know the first file listed is the one you want, in any case?
cmd: get /ProdData/Fusion/Payables/Invoices/OUT/Source/DOE*.txt /var/ftdata/TEST/DOE/FROM_Laclede
get /ProdData/Fusion/Payables/Invoices/OUT/Source/DOE5629407.txt /var/ftdata/TEST/DOE/FROM_Laclede/DOE5629407.txt
- 58 bytes received in 0.00 Seconds 29000.0 Kbytes/sec.
get /ProdData/Fusion/Payables/Invoices/OUT/Source/DOE5629421.txt /var/ftdata/TEST/DOE/FROM_Laclede/DOE5629421.txt
- 60 bytes received in 0.00 Seconds 60000.0 Kbytes/sec.
get /ProdData/Fusion/Payables/Invoices/OUT/Source/DOE5629432.txt /var/ftdata/TEST/DOE/FROM_Laclede/DOE5629432.txt
- 339 bytes received in 0.00 Seconds 339000.0 Kbytes/sec.
get /ProdData/Fusion/Payables/Invoices/OUT/Source/DOE5629444.txt /var/ftdata/TEST/DOE/FROM_Laclede/DOE5629444.txt
- 917 bytes received in 0.00 Seconds 458500.0 Kbytes/sec.
get /ProdData/Fusion/Payables/Invoices/OUT/Source/DOE5629454.txt /var/ftdata/TEST/DOE/FROM_Laclede/DOE5629454.txt
- 137 bytes received in 0.00 Seconds 137000.0 Kbytes/sec.
Are you possibly using sftp as this would allow for "glob(3) characters and may match multiple files"? Then you could ssh to identify the file of interest and sftp (or scp ) exactly this one, then.