Sample Header Ad - 728x90

Using regular expression in lftp to ignore some strings from file name

0 votes
1 answer
261 views
Get specific file with name like abc_yyyymmdd_hhmmss.csv from directory using mget. Example files in a folder: abc_20221202_145911.csv abc_20221202_145921.csv abc_20221202_145941.csv abc_20181202_145941.csv But, I want to ignore hhmmss part. I want to get all files with abc_20221202_*.csv How to include * in mget. My code below: File=abc Date=20221202 Filename=$File$Date"_*".csv // Assume I have sftp connection established and I am in directory //where files with above naming convention are present. As I can //download the file when hardcoding exact file name during testing conn='lftp $protocol://$user:$password@$sftp_server -p $port /error.log cd $path mget $Filename DOWNLOAD' The script is able to find the file but not able to retrieve it from the server. But, if I remove * and provide the entire file name abc_20221202_145941.csv it will download the file. Why is * causing issue in retrieving the file
Asked by likeGreen (101 rep)
Dec 5, 2022, 04:12 PM
Last activity: Dec 6, 2022, 10:26 PM