Powershell remove empty folder

we can use this flag to remove --delete-empty-src-dirs -vv empty folder. for powershell what can we add? basically after upload is complete, I want the empty folder to remove.

I tried

&"C:\rclone.exe" moveto "N:\ABC" "remote:ABC" --delete-empty-src-dirs -vv

but getting error

+ CategoryInfo          : NotSpecified: (Error: unknown ...-empty-src-dirs:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
  rclone moveto source:path dest:path [flags]
  -h, --help   help for moveto
Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.
2022/11/13 18:55:28 Fatal error: unknown flag: --delete-empty-src-dirs

but for batch script (.bat) this flag is working fine.

Tough to guess since you missed the whole help and support template.

What version are you running?
Does the command work normally?

--delete-empty-src-dirs works with rclone move, not rclone moveto

imho, rclone moveto should only be used for
rename files or upload single files to other than their existing name
otherwise use rclone move

rclone move d:\source d:\test --delete-empty-src-dirs --dry-run 
NOTICE: Local file system at //?/d:/test: Skipped server-side directory move as --dry-run is set

rclone moveto d:\source d:\test --delete-empty-src-dirs --dry-run 
Error: unknown flag: --delete-empty-src-dirs
Fatal error: unknown flag: --delete-empty-src-dirs

1 Like

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