FG
💻 Software

How do I use find to copy all found files to a new name in their same directories?

Fresh5 days ago
Mar 15, 202610154 views
Confidence Score0%
0%

Problem

I've got a simple command that does almost what I want. The following will locate all files with a suffix of '_compressed.swf' and copy each into its same directory with a '.bak2' appended: find '../content' -name '*_compressed.swf' -print0 | xargs -0 -I {} cp {} {}.bak2 Results In: /content/somefi…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I use find to copy all found files to a new name in their same directories?

Low Risk

This solution is probably the most portable: There is also the famous rename.pl script which is distributed with Perl, and the rename command which could have made this a bit easier. These aren't available on all distributions though, these commands…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment