Resolving External File Versioning Error

Hi,

I’m using Syncthing on Windows 10. I have setup external file versioning for each folder in Syncthing as I want files deleted on my remote device to be sent to recycle bin on Windows instead of being permanently deleted. (Correct me if I’m wrong, but Syncthing doesn’t provide a built-in way to do this)

Code:

:: The parameters we get from Syncthing, '~' removes quotes if any
set FOLDER_PATH=%~1
set FILE_PATH=%~2

:: Finally move the file to recycle bin
nircmd moverecyclebin "%FOLDER_PATH%\%FILE_PATH%"

The problem is, the script of external file versioning failed for some of he files due to them having special characters. Sample filename : .Shared\2Phmqcd1Ca7r8STOstOWEpjwYvHiz0XBlKGTybYAs-8=.thumb.tmp Now I’m stuck with the folder being Out of Sync, have no idea how to resolve this.

Can anyone help?

Would you mind using PowerShell instead? It’s much better in handling special characters than the old command prompt. There’s a working example at https://docs.syncthing.net/users/versioning.html#move-to-the-recycle-bin-using-powershell.

1 Like

Made no difference. Still getting error. It changed from exit status 2 to exit status 0xfffd0000

I copied the code exactly like in the website.

# PowerShell has no native method to recycle files, so we use Visual
# Basic to perform the operation. If succeeded, we also include the
# recycled file in the Syncthing's DEBUG output.
Add-Type -AssemblyName Microsoft.VisualBasic
[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile($args,'OnlyErrorDialogs','SendToRecycleBin')
if ($?) {
  Write-Output ("Recycled " + $args + ".")
}

Sample file : nextapp.fx_5.0.1.2-5078_minAPI7(arm64-v8a,armeabi,armeabi-v7a,mips,mips64,x86,x86_64)(nodpi)_apkmirror.com.apk

Ok, it’s working now. As soon as I setup the powershell script, my Bitdefender AV went haywire and blocked everything… SyncTrayzor, Syncthing, the powershell script, the files it sent to recycle bin.

I had excluded all, but some things were still blocked. After a restart it started working. Thanks :grinning:

1 Like