相关文章推荐
追风的小虾米  ·  在 ASP.NET Core ...·  4 月前    · 
慷慨的蚂蚁  ·  Unable to access your ...·  3 月前    · 
刚毅的海龟  ·  426 Upgrade Required ...·  2 天前    · 
刚失恋的水煮肉  ·  curl ...·  1 年前    · 
满身肌肉的遥控器  ·  JS ...·  2 年前    · 
兴奋的牛肉面  ·  delphi windows xp ...·  2 年前    · 

Hi All,

We have a vendor, from where we download the file. Till few days back we were able to download the file successfully using lftp but suddenly the lftp get command gives error saying "get: Access failed: No such file" even though i can see the file present on server. No config or protocols have been changed either at vendor side or our side.
To give more details, we are using mget commands as there is wildcards when we pass the filename ..
this is how we connect to remote server:

lftp sftp://user:password@ip address

`mget "ABC-TEST_PQR_Dummy-??????_?????????.xlsx"`
mget: Access failed: No such file (ABC-TEST_PQR_Dummy-202105_123456789.xlsx)
mget: Access failed: No such file (ABC-TEST_PQR_Dummy-202106_123456789.xlsx)
mget: Access failed: No such file (ABC-TEST_PQR_Dummy-202107_123456789.xlsx)

First ? set is to indicate date and second ? set is file Unique ID#. Interestingly, it shows not such file but it lists all files present with this wildcard format. Also if i try

get "ABC-TEST_PQR_Dummy-202105_123456789.xlsx"
get: Access failed: No such file (ABC-TEST_PQR_Dummy-202105_123456789.xlsx)

but if try without the unique 9 digit file ID# , it gets transferred

get "ABC-TEST_PQR_Dummy-202105.xlsx"
54234 bytes transferred

Please not that this is windows server and we access it either via Linux terminal using lftp or through chrome using weburl which shows website from where we can download the file manually. On website this unique 9 digit identifier is not present in file name so i believe there is something to do with filename instead of permission issue.

Sorry if all this sounds confusing, let me know if need any other details to explain it. Kindly suggest what and where is should look to resolve this.
Thank You

I had a similar problem for one of the suppliers that we use at work. I got around it by first getting a list of files from the lftp and then use bash to get the filename of the file we wanted.

lftp -c "open -u user,pass ftp://ip ; cd Shipping_information ; find -d 2 > /srv/scripts/bolorders-nl/list.txt" 

With a bit of editing that might help get you the file that you want.

Well there's your problem, right there! :grin:

It sounds like the last field is being added dynamically by the server and it's not really part of the name. Maybe it has something to do with how Windows shortens long pathnames into 8.3 names, but I don't know.

It's an interesting problem in that your ftp server is reporting a filename that then doesn't exist when you try to access it. Sounds like a bug in the ftp server (I don't see how a client could be expected to "know" to just delete some arbitrary suffix off the end of the name).

Good luck!

Just to add to my previous answer. What i did also is that for one of the scripts that has a dynamic name (in my case only the date part) is to create a variable which has all the variables in it and then use the variable as the name to download. That way the ftp gets the full name instead of filling in the variables when its connecting.

I hope you understand what i am trying to say. I checked if i still had my example but i cant find it just now.

Thank you Azhrei,
So this addition of last field unique ID, is this being done by server at our end (the linux server) or the remote server from where we are getting the file (Windows server). And also do you happen to know if there is any config which we can change and avoid adding this last field.

Thanks You

Thank you Sdohmen,
Yes i understand what you trying to convey and thanks for you valuable inputs. So there are 2 kind of files one i mentioned earlier where we have YYYYMM part which provide uniqueness but there is another set of file where we do not have any identifier in file name like:

ABC_PQR.txt
Now these files get their uniqueness out of that last field identoier which is getting added by server, so these are the files:

ABC_PQR_123456.txt ABC_PQR_456789.txt ABC_PQR_123789.txt

Now in this case what can i do to get the latest file, because if i remove the last part then how can i tell my
"get" command which file to download. Hope i didnt confuse you.

I can only guess, but I would expect that it's the Windows server that is adding the uniqueness field (I can't think of any reason why the client would do that?). That means the configuration likely changed recently on the Windows box; you'll need to contact them and ask them what changed. I can't help with configuring Windows applications, though, because I never use Windows. :wink::grin:

Thank you all for valuable inputs on this, i reached out to vendor and explained the issue. They couldn't provide any rational explanation why files are showing with identifier at server sised.
So short story is they will remove the identifier from file and copy the files on different location for us where we can download the files easily using mget command.

Thank you again.