Skip to main content

rclone Lsd

rclone lsd lists directories (not files) at the given path. By default, it only shows one level deep — making it perfect for quickly exploring a remote's folder structure.

Quick Summary

lsd shows directories only, one level at a time. Use it to explore bucket structure, verify remote organization, or check that sync operations created the expected folders.

Basic Syntax

rclone lsd REMOTE:PATH [flags]
# List top-level directories in a bucket
rclone lsd remote:my-bucket

# List subdirectories under a specific path
rclone lsd remote:my-bucket/backups

# List local directories
rclone lsd /var/www

Output Format

Each line shows: MODIFIED_DATE MODIFIED_TIME SIZE DIRECTORY_NAME

          -1 2024-01-15 10:30:00        -1 backups
-1 2024-01-15 10:30:00 -1 configs
-1 2024-01-15 10:30:00 -1 media

Key Flags

FlagDescription
-R / --recursiveList directories recursively
--max-depth NLimit directory listing depth
--include PATTERNOnly show directories matching pattern
--exclude PATTERNHide directories matching pattern

Practical Examples

Explore a Remote's Structure

# Top-level buckets/directories
rclone lsd remote:

# What's inside a specific bucket
rclone lsd remote:my-bucket

# Go deeper
rclone lsd remote:my-bucket/backups

List All Directories Recursively

# Full directory tree
rclone lsd remote:my-bucket -R

# Tree limited to 3 levels deep
rclone lsd remote:my-bucket -R --max-depth 3

Verify Backup Structure

# Check that daily backup directories exist
rclone lsd remote:backups/daily
# Expected output: 2024-01-13, 2024-01-14, 2024-01-15

# Count backup directories
rclone lsd remote:backups/daily | wc -l

Find Directories by Pattern

# List only directories starting with "2024"
rclone lsd remote:backups --include "2024*"

lsd vs ls vs lsf

CommandWhat It ShowsDefault Depth
lsdDirectories only1 level
lsFiles onlyRecursive
lsfFiles and/or directories1 level (configurable)

Common Pitfalls

PitfallConsequencePrevention
Expecting files in outputlsd only shows directoriesUse ls or lsf for files
Assuming recursive by defaultOnly shows one levelAdd -R for recursive listing
Object storage "directories"Some backends don't have real directoriesDirectories appear when objects with / in key exist

What's Next

Examples with Output

1. List top-level directories

See only the root folders of your remote. Command:

rclone lsd gdrive:

Output:

          -1 2024-01-01 10:00:00        -1 Documents
-1 2024-01-02 12:00:00 -1 Photos
-1 2024-01-03 15:30:00 -1 Backups

2. Recursive directory listing

Explore the entire folder structure tree. Command:

rclone lsd remote:parent_dir -R

Output:

          -1 2024-01-01 10:00:00        -1 subfolder1
-1 2024-01-01 10:05:00 -1 subfolder1/nested1
-1 2024-01-02 12:00:00 -1 subfolder2

3. Filter directories by name

Find specific folders matching a pattern. Command:

rclone lsd remote: --include "2023*"

Output:

          -1 2024-01-01 10:00:00        -1 2023_Archive
-1 2024-01-01 10:05:00 -1 2023_Photos

4. Check for existence of a directory

Verify if a path exists and is a directory. Command:

rclone lsd remote:my_target_dir && echo "Exists"

Output:

(Directory listing follows)
Exists

5. List local directory structure

Use rclone as a consistent tool for local folder inspection. Command:

rclone lsd /var/www

Output:

          -1 2024-01-15 08:00:00        -1 html
-1 2024-01-15 08:00:00 -1 logs