FG
šŸ’» Software

Linux: how to copy a file with a certain name pattern for which the exact place in the complex directory-structure is unknown

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

Problem

I want to copy all files with the name XYZ* into one folder. The problem is that the files are in different subfolders and that not even the depth of the folder structure is the same for all files. Luckily, at least each file has a unique name. Of course, I thought about the cp command but I guess …

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Linux: how to copy a file with a certain name pattern for which the exact place in the complex directory-structure is unknown

Low Risk

If you want to avoid starting many separate processes (as using may do) using bash (and don't have zsh for its ** form) you can do a single cp as follows: The $(...) form is a posix version of back-tick-quoted process substitution. Following is an e…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment