Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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) :-

File1.jpg
File2.gif
File3'Hello.txt

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.

File3\'Hello.txt

So how to avoid TAR doing this escaping ?

Thanks for any suggestions,

Dave

Comment on TAR Escaping
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.
      Hmmm,

      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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://476437]
Approved by Tanalis
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-09-17 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (97 votes), past polls