rsync: Not Iterating Sub-Directories - Modify Timestamp?

Abstract: Resolve rsync skipping sub-directories by fixing trailing slash syntax, filter rules, and permission issues rather than modifying timestamps.

Created: 2026-10-24 by
The issue where rsync appears to skip sub-directories is rarely caused by timestamp modifications themselves. Instead, it typically stems from incorrect path syntax, such as trailing slashes that change source interpretation, or restrictive filter rules in your command. Understanding how rsync calculates file hashes and compares directory structures is essential for resolving these iteration failures effectively.

Common Causes for Missing Sub-Directories

When rsync does not iterate through expected sub-directories, the most frequent culprit is the presence or absence of a trailing slash on the source path. In rsync, the syntax rsync -av /source/ /dest/ copies the *contents* of the source directory into the destination. Conversely, using rsync -av /source /dest/ copies the source directory itself, creating a nested structure like /dest/source/.... If you expect files to appear directly in the destination root but they are nested inside a folder named after the source, this syntax error is likely responsible. Another common cause involves the use of exclude or include filters. If you have previously used options like --exclude='*/' or similar patterns in a script, rsync might be skipping directories based on those rules. Additionally, permission issues can prevent rsync from reading sub-directories. If the user running the rsync command lacks read and execute permissions on a sub-directory, rsync will silently skip it unless verbose logging is enabled. Always check the output of ls -l on the source directory to verify access rights.

Verifying Path Syntax and Structure

To diagnose whether path syntax is the issue, compare the directory tree before and after the sync operation. Use the tree command or find . -type d to visualize the structure. If the sub-directories are missing in the destination, check if they exist under a parent folder matching the source name. For example, if syncing /home/user/docs to /backup, ensure you are not inadvertently creating /backup/docs/... when you wanted /backup/.... You can also test the behavior with a small, controlled directory structure. Create a temporary folder with nested sub-directories and run rsync with the -v (verbose) flag. This will print every file and directory being transferred. If the verbose output stops at a certain level, the issue is likely related to filters or permissions rather than timestamps. Refer to our guide on Using rsync to Merge Two Source Directories for more insights on managing complex directory structures during synchronization.

The Role of Timestamps in Syncing

Timestamps play a critical role in determining whether rsync needs to transfer a file. By default, rsync uses a quick-check algorithm that compares modification times and file sizes. If the timestamps match, rsync assumes the files are identical and skips them. However, modifying timestamps should not prevent rsync from iterating over sub-directories. If sub-directories are not being visited at all, the problem lies elsewhere. It is important to distinguish between skipping files due to unchanged timestamps and skipping directories entirely. If rsync iterates through the directory tree but does not update files, adjusting the --modify-window option might help. This option allows rsync to consider two files identical if their timestamps differ by less than the specified number of seconds. This is useful when dealing with filesystems that have different timestamp granularities, such as transferring files between Linux and Windows systems. For cases where you need to preserve specific ownership or group attributes without affecting iteration, understanding options like --no-o is helpful. Our article Understanding the '--no-o' Option in rsync: Preserving Timestamps explains how various flags impact attribute preservation, which can indirectly affect sync behavior if permissions are involved.

Debugging with Verbose and Dry-Run Modes

Effective debugging requires enabling detailed logging. Use the -vv flag for very verbose output, which shows exactly what rsync is doing at each step. This includes checking directory contents, comparing timestamps, and deciding whether to transfer files. Combine this with -n (dry-run) to simulate the sync without making any changes. This allows you to see which files would be transferred and identify any silent skips. If you suspect permission issues, run rsync with sudo if appropriate, or check the logs for "Permission denied" errors. These errors often indicate that rsync cannot enter a sub-directory to inspect its contents. Ensure that the target directory has sufficient disk space and that the filesystem is not read-only. Additionally, verify that network connections are stable if syncing over SSH, as interrupted connections can sometimes lead to incomplete directory iterations.

Best Practices for Reliable Synchronization

To avoid common pitfalls, always double-check your source and destination paths. Use absolute paths to prevent confusion regarding the current working directory. Regularly review your exclude lists to ensure they do not inadvertently block sub-directories. Consider using the --stats flag to get a summary of transferred data, which can help verify that the expected volume of files was processed. For large-scale synchronizations involving many sub-directories, consider breaking the process into smaller chunks or using parallel transfers with tools like parallel-rsync. This can improve performance and make it easier to isolate issues. Always test your rsync commands in a safe environment before applying them to production data. For advanced scenarios involving root directories, consult Syncing Root Directories: A Safe Idea with Rsync? to understand the risks and best practices associated with high-level synchronization tasks.

Frequently Asked Questions

Why does rsync skip some files even with the -av flag?

Rsync skips files if their modification time and size match the destination copy, assuming no changes were made. You can force re-transfer by using the -c (checksum) option, though this is slower.

How can I fix permission denied errors during rsync?

Ensure the user running rsync has read and execute permissions on the source directories and write permissions on the destination. Using sudo may be necessary if the source contains protected files.

Does modifying timestamps affect directory iteration?

No, changing timestamps does not prevent rsync from entering or listing sub-directories. It only affects whether individual files are transferred based on the quick-check algorithm.

What is the difference between trailing slashes in rsync?

A trailing slash on the source (/src/) copies the contents into the destination, while omitting it (/src) copies the directory itself, creating a nested folder in the destination.

Can I use rsync to sync only new sub-directories?

Yes, rsync naturally handles this by checking directory structures. If a sub-directory exists in the source but not the destination, rsync will create it and copy its contents.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More