Rclone call responds with error in filename

What is the problem you are having with rclone?

Calling rclone with:

"C:\msys64\bin\rclone.exe" `
  --log-file="C:\Users\<username>\AppData\Local\Temp\2023-05-02_19-00-01_rclone.log" `
  --log-level=INFO `
  --delete-after `
  --ignore-errors `
  sync `
  ":http,url='https://ftp.halifax.rwth-aachen.de':/cygwin/" `
  "//files-sz/depot/Software/cygwin/3/mirror/"

(Backticks are line continuation signs. It is all on one line).

rclone responds with:

Failed to open log file: open "C:\Users\<username>\AppData\Local\Temp\2023-05-02_19-00-01_rclone.log": Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.
ps> dir "C:\Users\<username>\AppData\Local\Temp\2023-05-02_19-00-01_rclone.log"
    Verzeichnis: C:\Users\<username>\AppData\Local\Temp


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       02.05.2023     19:00              0 2023-05-02_19-00-01_rclone.log

I'd assume this is something not correct. Since the very same filename works if handled to a simple dir command. Even if called from the same script.

Run the command 'rclone version' and share the full output of the command.

PS C:\Users\<username>\Documents> rclone version
rclone v1.62.2
- os/version: Microsoft Windows 10 Enterprise LTSC 2019 1809 (64 bit)
- os/kernel: 10.0.17763.4131 Build 17763.4131.4131 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.20.2
- go/linking: static
- go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

Storage source: http
Storage destination: UNC-Path, locally mounted

The command you were trying to run (eg rclone copy /tmp remote:tmp)

"C:\msys64\bin\rclone.exe" `
  --log-file="C:\Users\<username>\AppData\Local\Temp\2023-05-02_19-00-01_rclone.log" `
  --log-level=INFO `
  --delete-after `
  --ignore-errors `
  sync `
  ":http,url='https://ftp.halifax.rwth-aachen.de':/cygwin/" `
  "//files-sz/depot/Software/cygwin/3/mirror/"

(Backticks are line continuation signs. It is all on one line).

The rclone config contents with secrets removed.

config not used. It is empty.

A log from the command with the -vv flag

Since rclone does exaust an error with the log file name it does not write a log at all.

The same command does work given on commandline. It does not work from any script I've tried (at least windows -- Unix/Linux it's not a problem at all).

hello and welcome to the forum,

C:\Users\<username>\Local
does that folder exist or should it be
C:\Users\<username>\AppData\Local


C:\msys64\bin\rclone.exe"

do you need that quote character?

The Quote at the beginning is just missing from cut&paste.

Seems I've deleted a bit to much while hiding the username.

That error means you've specified a path that doesn't exist and/or you don't have access to it.

rclone about DB: --log-file /some/place/not/real/rclone.log -vv
2023/05/02 14:22:57 DEBUG : Setting --config "/opt/rclone/rclone.conf" from environment variable RCLONE_CONFIG="/opt/rclone/rclone.conf"
2023/05/02 14:22:57 Failed to open log file: open /some/place/not/real/rclone.log: no such file or directory

sorry, getting confused, with the typos/re-edits.

can you run the command on a single line, without backticks and post the full output.

Try replacing the = in this line with a space.

The above would work on Linux but I think the Windows shell works differently.

Does not matter. " " and "=" are working the same. And same error message from rclone.

Can you show us what <username> is? Does it have non ASCII characters in?

This error with the ├╝ instead of ű indicates that there is some character encoding problem going on. Perhaps that is the cause of the problem?

Rclone needs everything in UTF-8 and expects the terminal to be UTF-8 capable.

After digging deeply into this I found the case:

rclone was called by:

function StartRClone {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [string]$Log,
        [string]$Provider,
        [string]$Destination
    )
    "-----------------------------------------------------------" | WriteToLog
    $private:Exe = "rclone.exe"
    $private:App = "C:\msys64\bin\$Exe"

    $App | CheckFiles
    $Log | CheckFiles

    $rcloneStart = {
        param([string]$app, [string]$log, [string]$prv, [string]$dst)
        Get-ChildItem -Path "$log" | Out-File -FilePath $Log -Encoding UTF8 -Append -Force
    }

    try {
        $rcloneJob = Start-Job -Name "rclone" -ScriptBlock $rcloneStart -ArgumentList "$App", "$Log", "$Provider", "$Destination"
    }
    catch {
        "Could not start rclone." | WriteToLog
        exit
    }
}

StartRClone -Log "$rcloneLog" -Provider $provider -Destination "$(($swDepotMirror + '\').replace('\','/'))"

with

$global:startTime = Get-Date
$global:startTStr = $startTime.ToString("yyyy-MM-dd_HH-mm-ss")
$global:rclonelog = "$env:TEMP\" + $startTStr + "_rclone.log"

and the file precreated with

function CreateFiles {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory, ValueFromPipeline)]
        [string[]]$Path
    )
    PROCESS {
        foreach ($item in $Path) {
            try {
                $fd = New-Item -ItemType "File" -Path "$Item"
            }
            catch {
                "Could not create `"" + $item + "`"" | WriteToLog
                exit
            }
        }
    }
}

For an unknown reason a "0x00" was appended to the files name. This was not a problem. The ending of the files string "0x00" was just ignored by most commands. This way a valid file was created in a valid path:

PS[7.3.4] ls "C:\Users\sct-muc\AppData\Local\Temp\2023-03-29_16-55-15_rsync.log"

    Directory: C:\Users\sct-muc\AppData\Local\Temp

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---    Mi, 29.März.2023 16:55:15              0 2023-03-29_16-55-15_rsync.log

but rclone asked for

C:\Users\sct-muc\AppData\Local\Temp\2023-03-29_16-55-15_rsync.log\0x00

which lead to an illegal path name. But printing the file name as

[...]"C:\Users\sct-muc\AppData\Local\Temp\2023-03-29_16-55-15_rsync.log"[...]

only, ignoring the last character: "\0x00". The error message rclone printed just did not include the whole filename rclone asked for! This was not an issue with Unix/Linux, but Windows: Unix/Linux do allow "0x00" to be part of a file name. Windows does not. The same script ran together with rclone without any problems on Linux, but did not on Windows.
I've removed the last character "0x00" from the file name. Now it works with both: Linux and Windows!

Glad you tracked it down! The 0x00 would probably have shown if you'd put the output from rclone through hexdump as I suspect it was printed but not displayed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.