Skip to content

FTP: LSD/LS with option " --ftp-force-list-hidden" lists wrong directory structure #10324

Closed

Description

@giteichi

Before you start

  • I have searched the forum and the existing issues for this problem.
  • I have tested with the latest beta or stable release and can still reproduce the problem.
  • This is a reproducible bug, not a usage question (questions belong on the forum).

Associated forum post URL

No response

What is the problem you are having with rclone?

Description:

When running LSD with the --ftp-force-list-hidden option, the contents of the specified directory are not displayed. Instead, the contents of the FTP root directory are shown.

When using LS, the output shows a completely incorrect directory structure.

Expected behavior:

The command should display the contents and directory structure of the specified folder.

Actual behavior:

LSD --ftp-force-list-hidden displays the FTP root directory’s contents, while LS displays an incorrect directory structure containing

LS without --ftp-force-list-hidden:
sudo rclone ls ftp:/WD-MyPassport2628-01/backup/Nextcloud | grep IMG_20211231_154158.jpg

474106 __groupfolders/3/Takeout/Google Fotos/Fotos von 2021/IMG_20211231_154158.jpg
   747 __groupfolders/3/Takeout/Google Fotos/Fotos von 2021/IMG_20211231_154158.jpg.supplemental-metadata.json

LS with --ftp-force-list-hidden:
sudo rclone ls ftp:/WD-MyPassport2628-01/backup/Nextcloud --ftp-force-list-hidden | grep IMG_20211231_154158.jpg

474106 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg
     747 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json
  474106 FRITZ/IMG_20211231_154158.jpg
     747 FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json
  474106 WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg
     747 WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json
  474106 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg
     747 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json
  474106 WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg
     747 WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json
  474106 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg
     747 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json
  474106 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg
     747 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json
  474106 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg
     747 WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/WD-MyPassport2628-01/FRITZ/IMG_20211231_154158.jpg.supplemental-metadata.json

....Aborted

rclone version

rclone v1.75.2

  • os/version: raspbian 13.7 (64 bit)
  • os/kernel: 6.18.60+rpt-rpi-v8 (aarch64)
  • os/type: linux
  • os/arch: arm64 (ARMv8 compatible)
  • go/version: go1.26.9
  • go/linking: static
  • go/tags: none

Operating system

Linux

Which cloud storage system are you using?

local disk, ftp (AVM FritzBox)

Output of rclone config redacted

[BG_SSH]
type = sftp
host = XXX
key_pem = XXX
shell_type = unix
md5sum_command = md5sum
sha1sum_command = sha1sum
user = XXX

[DW_SSH]
type = sftp
host = XXX
key_pem = XXX
shell_type = unix
md5sum_command = md5sum
sha1sum_command = sha1sum

[Hdd]
type = smb
host = XXX
user = XXX
pass = XXX

[SMB_BG]
type = smb
host = XXX
user = XXX
pass = XXX

[ftp]
type = ftp
host = XXX
user = XXX
pass = XXX

The command you were trying to run

sudo rclone lsd ftp:/WD-MyPassport2628-01/backup/Nextcloud --ftp-force-list-hidden -vv

A log from the command with the -vv flag

2026/11/12 11:34:11 DEBUG : rclone: Version "v1.75.2" starting with parameters ["rclone" "lsd" "ftp:/WD-MyPassport2628-01/backup/Nextcloud" "--ftp-force-list-hidden" "-vv"]
2026/11/12 11:34:11 DEBUG : Creating backend with remote "ftp:/WD-MyPassport2628-01/backup/Nextcloud"
2026/11/12 11:34:11 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2026/11/12 11:34:11 DEBUG : ftp: detected overridden config - adding "{Sn4gH}" suffix to name
2026/11/12 11:34:11 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: Connecting to FTP server
2026/11/12 11:34:11 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: dial("tcp","192.168.27.1:21")
2026/11/12 11:34:11 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: > dial: conn=192.168.46.2:38430->192.168.27.1:21, err=<nil>
2026/11/12 11:34:12 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: dial("tcp","192.168.27.1:49915")
2026/11/12 11:34:12 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: > dial: conn=192.168.46.2:40096->192.168.27.1:49915, err=<nil>
2026/11/12 11:34:13 DEBUG : fs cache: renaming cache item "ftp:/WD-MyPassport2628-01/backup/Nextcloud" to be canonical "ftp{Sn4gH}:/WD-MyPassport2628-01/backup/Nextcloud"
2026/11/12 11:34:13 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: dial("tcp","192.168.27.1:52299")
2026/11/12 11:34:13 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: > dial: conn=192.168.46.2:49192->192.168.27.1:52299, err=<nil>
          -1 2025-03-16 01:00:00        -1 FRITZ
          -1 2026-11-12 11:16:00        -1 WD-MyPassport2628-01
          -1 2026-11-03 11:23:00        -1 media
2026/11/12 11:34:13 DEBUG : 3 go routines active
2026/11/12 11:34:13 DEBUG : ftp://192.168.27.1:21/WD-MyPassport2628-01/backup/Nextcloud: closing 1 unused connections

Anything else?

No response

Activity

  1. sathvik8317 commented on Nov 13, 2026

    @sathvik8317

    Hi, I'd like to work on this.

    From the code: with --ftp-force-list-hidden set, rclone skips MLSD and the jlaffaye/ftp library sends LIST -a <path> (ServerConn.List in ftp.go). My guess is the FritzBox FTP server takes -a as the argument and drops the path, so every directory returns the root listing. That would also explain the ls output: each subdirectory "contains" the root again, so the recursion keeps nesting WD-MyPassport2628-01/....

    @giteichi could you check this with curl, which lets you send a custom list command?

    1. Path in the command, run from the root:
      curl -u USER --list-only -X "LIST -a /WD-MyPassport2628-01/backup/Nextcloud" ftp://192.168.27.1/
    2. CWD into the folder first, then LIST -a with no path (curl does the CWD from the URL):
      curl -u USER --list-only -X "LIST -a" ftp://192.168.27.1/WD-MyPassport2628-01/backup/Nextcloud/

    Does (1) show the root and (2) show the Nextcloud folder?

    If so, my plan is:

    • When force_list_hidden is on, CWD into the directory and send LIST -a without a path. Pooled connections would need to go back to a known directory afterwards, so nothing else that relies on the current directory breaks.
    • Add a test with a server that ignores the path after -a, so this is covered.
    • I don't have a FritzBox, so I'd ask you to try a test build before it's merged.

    @ncw does that sound OK, and would you rather have the fix in the ftp backend or upstream in jlaffaye/ftp?

  2. giteichi commented on Nov 16, 2026

    @giteichi
    Author

    @sathvik8317 you guessed right.

    (1) shows the root and (2) the Nextcloud folder!

    Trying a test build should be no problem.

    Thanks in advance!

    Please feel free to get in touch, if you need further information!

  3. sathvik8317 commented on Nov 17, 2026

    @sathvik8317

    Thanks @giteichi, that confirms it: the server ignores the path after LIST -a.

    I'll start on the fix in the ftp backend (CWD into the folder, LIST -a with no path, then go back to the original dir on the pooled connection) and post a test build here when it's ready.

    @ncw I'm going with the backend fix unless you'd rather have it upstream in jlaffaye/ftp.

  4. sathvik8317 commented on Nov 17, 2026

    @sathvik8317

    @giteichi the fix is in #10380, and test builds are here: https://github.com/sathvik8317/rclone/releases/tag/test-10324 (Windows and Linux, amd64). Which OS are you on? If you need another one (macOS, ARM, e.g. a Raspberry Pi), tell me and I'll add it.

    Could you run the same commands as before with this build and --ftp-force-list-hidden, e.g.

    rclone lsd --ftp-force-list-hidden <remote>:WD-MyPassport2628-01/backup/Nextcloud
    rclone ls --ftp-force-list-hidden <remote>:WD-MyPassport2628-01/backup/Nextcloud

    The first should show the folders inside Nextcloud (not the root), and the second should no longer nest WD-MyPassport2628-01/... forever. Hidden files (dotfiles) should show up too.

  5. giteichi commented on Nov 18, 2026

    @giteichi
    Author

    Amazing job!

    Tested with Debian 13.0.

    Now everything works like expected.

    Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions