Filters in variable in a powershell-script

What is the problem you are having with rclone?

I am trying to create an PowerShell-Script. I want to exclude some folders/files which I added to a txt-file (exclude.txt)

System Volume Information/

The command for execution contains several variables that provide content. If I write the filter options directly in the command to be executed, it works as desired. If I include the filter options via a variable, they are not recognised (see below).
Perhaps someone has a tip on how I can include the filter options via a variable in PowerShell. I would be very grateful.

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

rclone v1.66.0

  • os/version: Microsoft Windows 11 Pro 23H2 (64 bit)
  • os/kernel: 10.0.22631.3447 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.22.1
  • go/linking: static
  • go/tags: cmount

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

SSH/SFTP -> Debian

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

This works:

$backupPath='backup:"Eigene Dateien"'
&$rclone sync $sourcePath $outputPath --progress --exclude-from "h:/programme/rclone/exclude.txt"

This does not work (error see below):

$backupPath='backup:"Eigene Dateien"'
$additionalSettings='--exclude-from "h:/programme/rclone/exclude.txt"'
&$rclone sync $sourcePath $outputPath --progress $additionalSettings

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

type = sftp
host = XXX
user = XXX
pass = XXX
shell_type = unix
md5sum_command = md5sum
sha1sum_command = sha1sum

A log from the command that you were trying to run with the -vv flag

H:\Programme\rclone>powershell.exe -ExecutionPolicy Bypass -File "H:\Programme\rclone\Backup_Eigene_Dateien.ps1"
Backup file location: backup:"Eigene Dateien"
**** Backing up: H:\ ****
Backing up 'H:\' into 'backup:"Eigene Dateien"'
Error: unknown flag: --exclude-from h:/programme/rclone/exclude.txt
rclone sync source:path dest:path [flags]

2024/05/12 XX:XX:XX Fatal error: unknown flag: --exclude-from h:/programme/rclone/exclude.txt

maybe try

1 Like

You are my hero! Thank you!!

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