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

Posted by Costi on Super User See other posts from Super User or by Costi
Published on 2010-06-01T23:07:47Z Indexed on 2010/06/02 11:44 UTC
Read the original article Hit count: 295

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?

© Super User or respective owner

Related posts about linux

Related posts about unix