Skip to main content

rclone Size

rclone size counts the total number of objects (files) and their combined size at the given path. It provides a quick, human-readable summary without listing individual files.

Quick Summary

Use size to check how much data is stored at a remote path before running transfers, to verify backup sizes, or to monitor storage consumption in scripts.

Basic Syntax​

rclone size REMOTE:PATH [flags]
# Check size of a remote bucket
rclone size remote:my-bucket

# Check size of a specific path
rclone size remote:my-bucket/backups/2024

# Check local directory size
rclone size /var/www/html

Output Example​

Total objects: 12,345
Total size: 4.567 GiB (4903281344 Bytes)

Key Flags​

FlagDescription
--jsonOutput as JSON (for scripts)
--include PATTERNOnly count files matching pattern
--exclude PATTERNExclude files from count
--min-size SIZEOnly count files larger than SIZE
--max-size SIZEOnly count files smaller than SIZE

Practical Examples​

Check Backup Size​

# How big is today's backup?
rclone size remote:backups/daily/$(date +%Y-%m-%d)

Monitor Storage Usage​

# Check total storage used per top-level directory
for dir in $(rclone lsf remote:my-bucket --dirs-only); do
echo -n "${dir}: "
rclone size "remote:my-bucket/${dir}" --json | jq -r '.bytes | . / 1073741824 | floor | tostring + " GB"'
done

JSON Output for Scripts​

rclone size remote:my-bucket --json
{
"count": 12345,
"bytes": 4903281344
}

Size of Specific File Types​

# How much space do log files use?
rclone size remote:my-bucket --include "*.log"

# How much space do images use?
rclone size remote:media --include "*.{jpg,png,gif,webp}"

Pre-Transfer Check​

# Check source size before starting a large copy
echo "Source size:"
rclone size /var/www/html
echo "Available at destination:"
rclone about remote:my-bucket

Common Pitfalls​

PitfallConsequencePrevention
Running on a huge bucketSlow — must enumerate all objectsUse --include to narrow scope
GiB vs GB confusion1 GiB = 1.074 GB — sizes may seem "wrong"Note rclone uses binary units (GiB)
API costs on object storageListing operations charged per requestBe mindful of frequency with large buckets

What's Next​

Examples with Output​

1. Check total size of a bucket​

Get a quick summary of object count and storage usage. Command:

rclone size gdrive:Backups

Output:

Total objects: 1500
Total size: 45.2 GiB (48534123456 Byte)

2. Size of specific file types​

Calculate how much space only your images are consuming. Command:

rclone size remote:media --include "*.jpg"

Output:

Total objects: 250
Total size: 1.2 GiB (1288490188 Byte)

3. Exclude large files from count​

Determine size without including heavy archive files. Command:

rclone size remote:bucket --max-size 100M

Output:

Total objects: 1200
Total size: 5 GiB (5368709120 Byte)

4. Check size for recently modified files​

See how much data was added in the last 24 hours. Command:

rclone size remote:bucket --max-age 24h

Output:

Total objects: 12
Total size: 150 MiB (157286400 Byte)

5. Machine-readable size output​

Use JSON format for easy parsing in scripts or dashboards. Command:

rclone size remote:bucket --json

Output:

{"count":1500,"bytes":48534123456}