FG

Using find and tar with files with special characters in the name

Fresh3 days ago
Mar 15, 202610478 views
Confidence Score0%
0%

Problem

I want to archive all .ctl files in a folder, recursively. The error message : I have these files: /home/db/dunn/j 74.ctl and j 75. Notice the extra space. What if the files have other special characters? How do I archive these files recursively?

Error Output

tar -cf ctlfiles.tar `find /home/db -name "*.ctl" -print`

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Using find and tar with files with special characters in the name

Low Risk

Use the feature of tar to tell it to read the list of files from another file (tar treats each line as a separate file). You can then use notation to have your shell generate a pseudo-file from the output of a command: If your shell does not support…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment