Listing and Inspecting
Last updated on 2026-08-24 | Edit this page
Overview
Questions
- How do I list files and directories in cloud storage?
- How can I visualize directory structure?
- How do I read file contents, delete files, and manage directories?
Objectives
- Use
rclone lsandrclone lsdto list files and folders - Visualize directory structure with
rclone tree - Create and delete directories with
rclone mkdir,rclone delete, andrclone purge - Read file contents with
rclone cat
Listing Contents: rclone ls
The rclone ls command lists files in a directory (not
folders).
Expected output:
12345 file.txt
67890 presentation.pptx
This shows file size (in bytes) and filename. Useful options:
Listing Directories: rclone lsd
The rclone lsd command lists only
directories (folders), not files.
Expected output:
-1 2026-02-15 10:30:00 -1 My Research
-1 2026-01-20 14:45:00 -1 Project Data
Visualizing Structure: rclone tree
The rclone tree command shows the directory structure
graphically:
Expected output:
/
├── file1.txt
├── file2.csv
└── subfolder/
├── nested-file.txt
└── data.json
Limit depth with --max-depth:
Creating Directories: rclone mkdir
Create multiple levels one at a time:
Reading File Contents: rclone cat
Display the contents of a file in cloud storage without downloading it:
Preview a CSV file before downloading:
Deleting Files and Folders
Quick Reference: Common Commands
| Command | Purpose | Syntax |
|---|---|---|
ls |
List files | rclone ls remote:path |
lsd |
List directories | rclone lsd remote:path |
tree |
Show folder structure | rclone tree remote:path |
mkdir |
Create folder | rclone mkdir remote:path |
cat |
Display file content | rclone cat remote:path |
delete |
Delete files | rclone delete remote:path |
purge |
Delete folder + contents | rclone purge remote:path |
check |
Verify integrity | rclone check source dest |
size |
Show total size | rclone size remote:path |
Each command shows different information:
rclone ls – lists files only with
sizes:
15 file1.txt
15 subfolder/file2.txt
rclone lsd – lists directories
only:
-1 2026-03-05 15:10:00 -1 challenge5
rclone tree --max-depth 2 – shows the
hierarchical structure of both files and folders:
/
└── challenge5/
├── file1.txt
└── subfolder/
Use ls to find specific files, lsd to see
top-level folders, and tree to visualize the full
layout.
Challenge 6.2: Delete Safely
Clean up test files using --dry-run first:
Verify the dry-run output shows exactly what you want to delete. Then delete:
Confirm files are gone:
Note: The folder itself remains (empty). To remove
the empty folder too, use rclone purge.
The dry-run should show files that would be deleted:
2026/03/05 15:20:15 INFO : file1.txt: Deleted (dry run)
2026/03/05 15:20:15 INFO : subfolder/file2.txt: Deleted (dry run)
After executing rclone delete,
rclone ls pomona-onedrive:/rclone-test/box-backup should
return no output, meaning no files remain. To remove the empty folder
entirely, use
rclone purge pomona-onedrive:/rclone-test/box-backup.
- rclone ls lists files, rclone lsd lists directories, and rclone tree shows the complete folder structure
- rclone cat displays file contents without downloading, useful for previewing data
- rclone delete removes files (not folders) while rclone purge removes folders and all contents
- Always preview destructive operations with –dry-run before executing them