I've got a script that's first copying a list of files into /etc/confbackups after running some other stuff, I'm having trouble with tar now though.
What I've got:
What I'm thinking this is supposed to do is create the archive as specified, move to directory then do that for all .conf files in that directory?
Any help appreciated! I'm not sure if I'm getting the order of my options right...
You'll have to put the values that some options expect directly after the option itself. Also, you'll have to tell tar to compress the file, too. Try it as
Meh ionno, I tried what you've got and some other variations I just randomly got off google but no luck.
I keep getting:
tar: .tar.gz: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
It ~is~ actually making a copy of the file (in the directory the script's in though...) but it's lacking the .tar.gz extension although when I open it, it does seem to be encrypted...
This is what I have at the moment. The idea is when any md5 match fails that that file would be copied and compressed into /etc/confbackups...
I tried using $list up here instead, *.conf was actually doing everything but the failed file which was weird (still not compressed though...)
I think I see your problem here. In $list, you have a list of files, separated by space, for example
And then you plug that into the tar command, not only as the list of files to be put into the archive, but as part of the name, too:
That's the command line as tar would see it. Since spaces separate options, the space in the variable screws with the option order.
You only want to create a compressed copy of those files that have changed, right?
Yeah thanks, I figured it all out today. Got my tar syntax way wrong got a helping hand for that and realized I had overthinked it waaaayyyyy too much. As far the bit with the sed, I only later realized that having an actual space in there actually replaced the colon in *.conf: with an actual space. So I fixed that bit myself at least. Thanks anyway!
I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it.
Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem?
tar tvf file1.tar
... (1 Reply)
Hi All,
Please could anyone advise what the purpose of the dot syntax in the following command means:
tar -cvf ${WORKING_BACKUP_ROOT}/${TAR_ARCHIVE_FILE} . >/${BACKUP_ROOT}/${ARCHIVE_LOG}
Many thanks (2 Replies)
Hello Everyone,
First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you !
I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
I am writing a perl script to tar multiple files (in unix) from a given directory to a given output directory. I do NOT want the file path included in the tar, so I've flagged the -C option. Example:
tar -cvf tar/1.tar -C htmp/source/ 1-1-1.xml
However, I need to do this for a number of target... (3 Replies)
Hi all,
I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Hi all,
4 files are returned when i issue 'find . -mtime -1 -type f -ls'.
./ora_475244.aud
./ora_671958.aud
./ora_934052.aud
./ora_934050.aud
However, when I issued the below command:
tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Hi,
On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files.
a) /usr/users/oracle/bin
b) /usr/users/oracle... (1 Reply)
I am trying to extract a file using tar. I cd'ed to the directory I wanted to start in. I had the tar file in the same directory. I executed tar xvf filename . It appeared that it was extracting into the directory the tar file was created from instead of into the directory I was in. How do I... (1 Reply)