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

Posted by Costi on Stack Overflow See other posts from Stack Overflow or by Costi
Published on 2010-06-01T23:07:47Z Indexed on 2010/06/01 23:13 UTC
Read the original article Hit count: 279

Filed under:
|
|
|

I want to archive all .ctl files in a folder, recursively.

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

The error message :

tar: Removing leading `/' from member names
tar: /home/db/dunn/j: Cannot stat: No such file or directory
tar: 74.ctl: Cannot stat: No such file or directory

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?

© Stack Overflow or respective owner

Related posts about linux

Related posts about unix