Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

TAR Escaping

by davemcgi (Novice)
on Jul 20, 2005 at 09:18 UTC ( #476437=perlquestion: print w/replies, xml ) Need Help??
davemcgi has asked for the wisdom of the Perl Monks concerning the following question:

I'm doing an incremental backup system using Perl and TAR.

I spider the directories, checking and comparing mtime and size against recorded database entries, updating and adding as necessary. Then I generate a list of files to process through TAR.

I have run up against a problem with TAR itself, I know this isn't strictly a Perl question, but maybe some unix guru has some suggestions.

I will issue this system command :-

tar -c -P -T ListOfFiles.txt -f MyTarFile.tar

where ListOfFiles.txt contains the following entries, delimited by usual chr(10) :-


When TAR is running, he is adding in an escape character to the third file, then of course reporting an error as he can't find the file on the disk.


So how to avoid TAR doing this escaping ?

Thanks for any suggestions,


Replies are listed 'Best First'.
Re: TAR Escaping
by jbrugger (Parson) on Jul 20, 2005 at 09:34 UTC
    hmmm tried it on my Debian stable with tar 1.14, and did all these things without a problem the File3'Hello.txt was tarred properly, without any errors.
    Perhaps you should update your system?
    ps. output of tar gave this (used -v to be verbose)
    jbrugger@deb:/tmp$ tar -cv -P -T txt.txt -f MyTarFile.tar File1.jpg File2.gif File3'hello.txt jbrugger@deb:/tmp$

    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

      We're on Redhat Linux 2.4.23 with tar (GNU tar) 1.13.17

      I get ...

      /bin/tar: File3\'Hello.txt: Cannot stat: No such file or directory

      I'll try an upgrade and see if that helps. Thanks.
Re: TAR Escaping
by sh1tn (Priest) on Jul 20, 2005 at 10:45 UTC
    Tested on Debian (testing) and Slackware (current) - works fine.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://476437]
Approved by Tanalis
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2017-11-25 02:36 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (355 votes). Check out past polls.