I need to create a tar file with a list of files from a directory.
The directory has about 1000+ files of which I only need to create a tar ball of 150 files. The 150 files I need in the tar ball do not have common names or a common start letter.
No two file names match, example: 1st file name can be metrics.txt, 2nd file name can be avaerage,txt . etc ......
I need to know if I can make use of while or for loop and keep adding file to the tar ball.
So I would like to do something like:
1) put all the 150 file names into a list.txt
2) go to the directory where these files are available
3) write a while or for loop
Is this something achievable or is the best way to achieve is:to copy the 150 files into another directory and then tar that directory.
What is your system? Some versions of tar have options for this.
Another option is timestamps. Keep the newest timestamp when making your last backup, then only add files newer than the file pointed to by -N. Both of these would avoid a giant loop running tar hundreds of times -- which is a bad idea since tar is not efficient used that way.
Put complete names in the file like a relative path from a starting directory.
Or a full path
This is efficient in that it invokes tar once. And simply writes to the current end of the tar file. The tarfile must exist for this work.
tar usually has a -u option (update). Try to avoid it, because it is sloooow. -r is a simpler way to keep the most recent copy of a file.
Let's say you want files just modified in the last 24 hours, here all put together.
Hi Team,
Following unix command is throwing error. Can anyone please help me to fix the issue?
tar -cvf /aa/bb/cc/tarball1.tar /x/y/z1/abc.ksh /x/y/z2/pqr.txt /x/y/z3/lmn.tmp
Error message thrown:
tar: Removing leading `/' from member names
OS: uname -a
Linux xyz... (1 Reply)
Hi everyone;
I need to create a shell script for full and incremental backup purposes. for incremental backup only for one folder (test1) located in /home/test1 syntax below works fine and have no problem: tar -cvf /home/backup/backup-0.tar.gz -g /home/test1/test.snar /home/test Problem is here... (5 Replies)
Hi,
the folder /home/nandy/test will have two files called
notepad1
nodepad2
when i issued
/home/nandy/test> tar -cvf componse.tar ./notepad1 ./notepad2 and no error
/home/nandy/test> tar -cvf nan.tar . --> this creates nan.tar with the below message
nan.tar same... (1 Reply)
Following are the list of files available in the dataout directory
a1.txt.gz
a2.txt.gz
b3.txt.gzStep 1:
now the tar file needs to be created as follows.
tar -cvf ab.tar *.gzAll the files with extn .gzg has to be bundled in the tar file.
Once the tar file is created, the files which are... (9 Replies)
I m planning to use puppet to implement organizational linux hardening policies across the linux servers.
To begin with i have downloaded.
puppet-2.7.1.tar.gz and tried some basic configuration to get start with puppet.
Now i want to roll out the puppet but before that i would like to make... (7 Replies)
I'm trying to do a incremental backup for a big NFS. Since space is not an issue, I don't want to compress them or end up with a big tarball for full backup( and a series of small tarballs for incremental backup). Basically I want the TAR backup/restore functionality but not TAR files up.... (3 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)
Hello, I'm quite new to HP-UX and I stumbeled upon some strange behaviour from tar.
I have a script like this:
find -mtime $days -type f|xargs tar cvf tarfile.tar
and it make me a tar file with files that has been changed in $days.
When i run 'tar tf tarfile.tar' it give me output like... (5 Replies)
Incremental Backup using TAR in sco Openserver 5.0
Dear all
I am using sco openserver 5.0. I wanted to take backup of two folder (each 600 MB size) with lot of files. I used to take backup using tar command daily using a script. But the same takes more time. Is there any way to take backup... (0 Replies)
Hello everyone!
I'm trying to make incremental tar archives of a folder for an example. On the box I use is UNIX AIX installed. I tried some sample codes I found on several web pages but with no success. Don't know what I'm doing wrong. Please write some sample code to make incremental tar... (0 Replies)