0

We have a table contains the file name's which are considered as inbound feed every week and one of the file name is as below

File_name : FEB_MERC_DATA_??????.txt

Sample inbound file which we got in the month of January "FEB_MERC_DATA_201901.txt"

We have a FTP script which will connect to the target server and search the file with the format and copies the file to our local server . We will run this ftp script from our local server .

Script :

#!/usr/bin/expect
spawn /usr/bin/sftp testing@192.168.1.55
expect "Expecting password:"
send "testing\n";
expect "sftp> "
send "lcd /incoming/load\n"
expect "sftp> "
send "cd /home/client-data/prod\n"
expect "sftp> "
send "mget FEB_MERC_DATA_??????.txt\n"
expect "sftp> "
send "bye\n"
expect eof

Issue:

In the month of FEB the client started to send file name in lower case "feb_merc_data_201902.txt" Because of the lower case file naming the "MGET" function is unable to pick the files and not getting copied to our local server as of now for a temporary solution we have changed the configuration to lower case file name .

Does any one have solution regarding the mget function so that it can ignore the case sensitive while copying the file so that even though the client send's either in upper or lower case we should be able to copy the file to target directory.

I have tried by using "-i" in the below ftp script but its throwing error as

mget: Invalid flag -i

#!/usr/bin/expect
spawn /usr/bin/sftp testing@192.168.1.55
expect "Expecting password:"
send "testing\n";
expect "sftp> "
send "lcd /incoming/load\n"
expect "sftp> "
send "cd /home/client-data/prod\n"
expect "sftp> "
send "mget -i FEB_MERC_DATA_??????.txt\n"
expect "sftp> "
send "bye\n"
expect eof

Does any one have solution for this ?

Thank you.

  • Why is it not the client's responsibility to conform to your standards. Do your clients have the right to assert their individual standards? If you have or acquire more than one client that can quickly become unmanageable so you must insist that the clients comply with your standards. If you have only one client, and do not expect another, then you can change your code to use the lower case. – Stephen Boston Feb 17 at 15:56
  • @StephenBoston Thak's for the response . Yeah but client has confirmed that they are going to send the file either in upper case or lower case they don't follow a proper standard. They have intimated us to change our logic to pull the file either if it's in lower case or upper case . – Rak kundra Feb 17 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.