FG
💻 Software

Copying a file only when it is newer than the destination

Fresh5 days ago
Mar 15, 202689074 views
Confidence Score1%
1%

Problem

How do I copy a file in Linux only when the file being copied is newer than the version at the destination? If the file at the destination is newer, I want the file copy to not go ahead.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Copying a file only when it is newer than the destination

Low Risk

Using the update option (-u) with cp should do it for you. http://beginnerlinuxtutorial.com/help-tutorial/basic-linux-commands/cp-linux-copy-command/

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment