FTP: Renaming Files Doesn't Work, Possibly Due to Extra / In Commands RNFR and RNTO

Advertisement

tygre
Guest

FTP: Renaming Files Doesn't Work, Possibly Due to Extra / In Commands RNFR and RNTO

Hi! I think that I may have found a bug with the RNFR and RNTO FTP commands, please see below.

Version of WinSCP: Version 6.1.2 (Build 13797 2023-09-19)

Version of Microsoft Windows: Windows 10 Pro, 21H1, 19043.2364, Windows Feature Experience Pack 120.2212.4190.0

Transfer protocol: FTP

GUI: Commander style

Error message: Syntax error in parameters or arguments

Precise steps:
  • Connect to a FTP server
  • Select a file (at the root or in a folder, same behaviour)
  • Press F2 to rename this file
  • Change the file name to a new, non-existing name
  • Press Return
The result is an error dialog box with the message "Syntax error in parameters or arguments" when expecting the file to be renamed.

Log:
For a file in the remote root directory:
. 2024-01-02 15:26:20.439 Renaming file "Test.txt" to "Test2.txt".
> 2024-01-02 15:26:20.439 RNFR /Test.txt
< 2024-01-02 15:26:20.456 350 Requested file action pending further information
> 2024-01-02 15:26:20.456 RNTO /Test2.txt
< 2024-01-02 15:26:20.477 501 Syntax error in parameters or arguments
For a file in a remote folder:
. 2024-01-02 15:28:36.074 Renaming file "Test.txt" to "Test2.txt".
> 2024-01-02 15:28:36.074 RNFR /Folder/Test.txt
< 2024-01-02 15:28:36.092 350 Requested file action pending further information
> 2024-01-02 15:28:36.092 RNTO /Folder/Test2.txt
< 2024-01-02 15:28:36.113 501 Syntax error in parameters or arguments
I believe that the error occurs because of the / char at the beginning of the RNFR and RNTO commands. When trying with CURL, I can rename files with the following commands:
curl -v -Q "RNFR Test.txt" -Q "RNTO Test2.txt" ftp://192.168.0.12/Test2.txt
curl -v -Q "RNFR Folder/Test.txt" -Q "RNTO Folder/Test2.txt" ftp://192.168.0.12/Test2.txt
Adding a / char at the beginning of the FTP commands results in an error:
curl -v -Q "RNFR /Test.txt" -Q "RNTO /Test2.txt" ftp://192.168.0.12/Test2.txt
> RNFR /Test.txt
* ftp_perform ends with SECONDARY: 0
< 350 Requested file action pending further information
> RNTO /Test2.txt
< 501 Syntax error in parameters or arguments
I didn't see if there's an option somewhere to remove the / char from the GIU?

And happy new year!
Tygre

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,330
Location:
Prague, Czechia

Re: FTP: Renaming Files Doesn't Work, Possibly Due to Extra / In Commands RNFR and RNTO

Thanks for your report. What FTP server is that? Can you attach a full session log file?
If the server does not support absolute paths with the commands, how can you move the file to another folder on that server? I do not think this is WinSCP bug. It's rather a limitation of the server.

Reply with quote

tygre
Joined:
Posts:
2

Hi Martin and thank you for your reply and for WinSCP!

The FTP server is RC-FTPd for / running on an Amiga computer.

I can't get a full log and test moving files but will report back in the coming days. You must be right though, it could certainly be a bug in the server: I didn't think about (and never tried) moving files!

Reply with quote

tygre
Joined:
Posts:
2

Hi Martin,

Please find in a (private) attachment a full session during which I tried to move a Test.txt file from one directory to another. Because moving uses RNTO and RNFR, it fails with my FTP server. Looking at the log, it seems to me that the bug is indeed with the server: commands that take a pathname, like CWD, SIZE, or MDTM, work fine with a pathname of the form "/xxx" except for RNTO and RNFR.

More tests with curl show that the server works as you'd expect except for RNTO and RNFR :-( Unless we could have an option to have relative pathnames (relative to CWD) rather than absolute pathnames, hence without prefix /, I'll have bypass this bug in this FTP server using curl.

Take care!
Tygre
  • WinSCP.log (30.34 KB, Private file)

Reply with quote

Advertisement

You can post new topics in this forum