Can't get attributes of file 'file.txt'.

Advertisement

rsford31
Joined:
Posts:
32

Can't get attributes of file 'file.txt'.

Hi,
I'm executing Winscp.com using a command file. I've created a session in Winscp.exe with the connection info. In the command file I have the following:
option batch abort
option confirm off
open CLIENT_SESSION
lcd E:\TEMP\edi
get file.txt
exit
When winscp.com is ran with /script="E:\Program Files\WinSCP 5.7.5\commands\CLIENTCOMMAND.txt" the download fails. The logs show the following:
 2018-06-11 15:28:23.043 Using FTP protocol.
. 2018-06-11 15:28:23.043 Doing startup conversation with host.
> 2018-06-11 15:28:23.043 PWD
< 2018-06-11 15:28:23.090 257 "/D:/bbsfiles" is current directory.
. 2018-06-11 15:28:23.090 Changing directory to "/D:/bbsfiles".
> 2018-06-11 15:28:23.090 CWD /D:/bbsfiles
< 2018-06-11 15:28:23.121 250 Directory changed to /D:/bbsfiles
. 2018-06-11 15:28:23.121 Getting current directory name.
> 2018-06-11 15:28:23.121 PWD
< 2018-06-11 15:28:23.168 257 "/D:/bbsfiles" is current directory.
. 2018-06-11 15:28:23.168 Startup conversation with host finished.
< 2018-06-11 15:28:23.168 Script: Active session: [1] CLIENT_SESSION
> 2018-06-11 15:28:23.168 Script: lcd E:\TEMP\edi
< 2018-06-11 15:28:23.168 Script: E:\TEMP\edi
> 2018-06-11 15:28:23.168 Script: get file.txt
. 2018-06-11 15:28:23.168 Listing file "file.txt".
. 2018-06-11 15:28:23.168 Retrieving file information...
> 2018-06-11 15:28:23.168 MLST /D:/bbsfiles/file.txt
< 2018-06-11 15:28:23.214 250-Listing /D:/bbsfiles/file.txt
< 2018-06-11 15:28:23.214      Type=file;Size=26832;Modify=20180611194500.964; file.txt
< 2018-06-11 15:28:23.214 250 End
. 2018-06-11 15:28:23.214 Type=file;Size=26832;Modify=20180611194500.964; file.txt
. 2018-06-11 15:28:23.214 Retrieving file information successful
< 2018-06-11 15:28:23.214 Script: Can't get attributes of file 'file.txt'.
< 2018-06-11 15:28:23.214 Script: File or folder 'file.txt' does not exist.
. 2018-06-11 15:28:23.214 Script: Failed
. 2018-06-11 15:28:23.214 Script: Exit code: 1
. 2018-06-11 15:28:23.230 Disconnected from server
But yet if I change the command to get file*.txt the file is successfully downloaded.
Any ideas?[/code]

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Can't get attributes of file 'file.txt'.

It looks like the file file.txt does not exist in the initial directory /D:/bbsfiles. Maybe you wanted to download the file from another folder.

Reply with quote

rsford31
Joined:
Posts:
32

Re: Can't get attributes of file 'file.txt'.

martin wrote:

It looks like the file file.txt does not exist in the initial directory /D:/bbsfiles. Maybe you wanted to download the file from another folder.

That was the first thing I checked. When I got the error, I manually FTPd to the server using the WinSCP gui and confirmed the file was in fact there.

Reply with quote

martin
Site Admin
martin avatar

Re: Can't get attributes of file 'file.txt'.

rsford31 wrote:

That was the first thing I checked. When I got the error, I manually FTPd to the server using the WinSCP gui and confirmed the file was in fact there.
Please attach a log file from WinSCP showing a download of that file.

Reply with quote

Guest

Re: Can't get attributes of file 'file.txt'.

martin wrote:

rsford31 wrote:

That was the first thing I checked. When I got the error, I manually FTPd to the server using the WinSCP gui and confirmed the file was in fact there.
Please attach a log file from WinSCP showing a download of that file.
I've attached them. I changed the script from using wildcards to the name of the actual file. The first part of the log is when I'm using the script and winscp.com to pull the files. You will see in there that it fails stating that MTSCDN.snd does not exit.
Further down is when I connect using WinScP.exe. It lists the files at the source which includes MTSCDN.snd. Further down it shows that I am able to download four files including the one that previously failed.
The version I'm using is 5.7.5. I've also tried this with the latest version of WinSCP with the same results.

Reply with quote

Advertisement

rsford31
Joined:
Posts:
32

Re: Can't get attributes of file 'file.txt'.

martin wrote:

Thanks for the log.

This bug has been added to the tracker:
https://winscp.net/tracker/1655

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.
I'm changing one of the processes slightly where I'm passing in the source dir, dest dir, current date, host IP, user id, password and protocol as paramenters. I've loaded the WinSCPnet.dll.
I've created an array of two files M2MUMMDD.dat and M2MCMMDD.dat. I've then opened a session i.e. $session = New-Object WinSCP.Session $session.Open($sessionOptions).
I'm then looping through the file array and checking if the file exists $session.FileExists($path) where $path is /D:/bbsfiles/mucc/. This is the actual path. I had tried to use just /bbsfiles/mucc/ in my previous process but it did not work.
$session.FileExists is always returning false. I even added Write-Host $session.Opened to ensure that the session was in fact opened and it was.
I manually logged in using WinSCP.exe to ensure that the file was there and it is.
I'm not sure if this is related to this bug or not.
Thoughts?

Reply with quote

rsford31
Joined:
Posts:
32

Re: Can't get attributes of file 'file.txt'.

rsford31 wrote:

martin wrote:

Thanks for the log.

This bug has been added to the tracker:
https://winscp.net/tracker/1655

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.
I'm changing one of the processes slightly where I'm passing in the source dir, dest dir, current date, host IP, user id, password and protocol as paramenters. I've loaded the WinSCPnet.dll.
I've created an array of two files M2MUMMDD.dat and M2MCMMDD.dat. I've then opened a session i.e. $session = New-Object WinSCP.Session $session.Open($sessionOptions).
I'm then looping through the file array and checking if the file exists $session.FileExists($path) where $path is /D:/bbsfiles/mucc/. This is the actual path. I had tried to use just /bbsfiles/mucc/ in my previous process but it did not work.
$session.FileExists is always returning false. I even added Write-Host $session.Opened to ensure that the session was in fact opened and it was.
I manually logged in using WinSCP.exe to ensure that the file was there and it is.
I'm not sure if this is related to this bug or not.
Thoughts?
This issue has been resolved. After working with "Martin" it was discovered that the file names I had in my script did not match the case of the files at the vendor. Once I had adjusted my scripts and tested I was no longer receiving the original error reported in this post.
This also resolved the issue I reported above.
Thank you so much for your help!

Reply with quote

Advertisement

You can post new topics in this forum