# Copying Files in Linux With a Progress Bar

By Corey J. Gallon · 2024-11-28 · https://gallon.me/copying-files-directories-in-linux-with-progress-indication.html

---

I’ve long used `rsync` for high fidelity, detailed copies of large swathes of files in Linux.  For example:

```bash
rsync -av --progress /source/directory /destination/directory
```

This gives you really nice, file-by-file progress indications — which is especially useful when moving large files across the network between machines or even locally across physical devices.

Today I was moving data from old hard drives and just wanted overall progress on the total job to be done.  `rsync` still FTW!

```bash
rsync -a --info=progress2 /source/directory /destination/directory/
```

NB — do not use a trailling `/` in the source directory if you want the copied files to be retained inside of that directory name in the destination!

This provides lovely summary output like this:

```bash
ubuntu@ubuntu:/media/ubuntu$ rsync -a --info=progress2 /source/directory /destination/directory
  2,675,525,167  71%   13.49MB/s    0:03:09 (xfr#1281, to-chk=0/1712)  
```

# A Better, More Robust Way to Do This

Running this command gets some extra good stuffs.

```bash
rsync -a --info=progress2 --checksum --partial /source/directory /destination/directory/
```

### Explanation of the Additions:

1. **`-checksum`**:
    - Ensures that files are compared using checksums rather than just timestamps and file sizes.
    - Guarantees that files are transferred only if their content differs, even if metadata like modification times are identical.
2. **`-partial`**:
    - Retains partially transferred files if the transfer is interrupted, allowing resumption without starting over.
