FG
💻 Software

tar -C with a wildcard file pattern

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

Problem

Can I use the tar command to change directories and use a wildcard file pattern? Here is what I am trying to do: It works if I don't change directory (-C), but I'm trying avoid absolute paths in the tar file. Here are some of the other attempts I've made: And this is the error I get: I know there a…

Error Output

tar -cf example.tar -C /path/to/file *.xml

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: tar -C with a wildcard file pattern

Low Risk

The problem is, the *.xml gets interpreted by the shell, not by tar. Therefore the xml files that it finds (if any) are in the directory you ran the tar command in. You would have to use a multi-stage operation (maybe involving pipes) to select the …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment