Depending on your OS version, there can be a -L flag on the tar command. This refers to a list file that you can populate beforehand. In you case:-
It's not too common, but a really good option and it's in AIX at least. What OS are you using?
It's extremely useful for extracting lots of files from a huge tar-file, i.e.
...edit the list file created to keep just the ones you want, then ....
Another option might be to ignore or handle the backup error. The tar-file you create won't have it anyway, so is that all you really need?
I hope that this helps,
Robin
Liverpool/Blackburn
UK
Why not use the -X (exclude file) option to tar, or, extended globbing in bash to unselect that directory?
You will now say "I don't use bash" or "My tar doesn't have -X" to which I'll respond "You didn't mention your system or versions or implementations"
Thanks for reply. I am using solaris. And i am in process of design a shell script in bash which tar all the files mentioned as a regular expression and removes them from the location(just like recycle bin functionality) and when a particular file or directory is not able to tar completely it should ignore and tar rest of them. i have a seprate log which shows which files/dir have been tar or not tar.
Rest everything is working fine except that the when unable to tar the directory the tar file still kept the empty directory which on restoring replaces the original directory with contents which is incorrect.
If tar is not done it should not store this directory at all. How can i prevent the tar of such directories.
Hope this helps in better understanding of the issue here.
Thanks and Regards
Rajan Gupta
---------- Post updated at 09:50 AM ---------- Previous update was at 09:22 AM ----------
Another option that came in my mind is to remove the directory in tar. I know it is possible througfh exclude folder but in my case this is not working. Can anyone highlight the case how can i remove the exesting non permission empty directory from tha tar created so that i have a clean tar.
Solaris (along with the majority of UNIX systems) has pax. You could just use find with the appropriate arguments to exclude all directories with mode 0. Since pax can read the file list on stdin, you can use a simple pipe:
Regards,
Alister
In case you didn't get the memo, today is International Gratuitous Backslash Quoting Day. Don't forget to celebrate.
All joking aside, no; it's not necessary. I'd edit it, but it won't hurt anything. Thank you for bringing attention to it. It may have confused a novice.
However, in some circumstances an exclamation point can cause problems, e.g. in bash when history expansion is enabled (although even in this instance, if whitespace follows it, no expansion occurs).
Quick question,
is it possible to make a Tar of completely directory and placing the tar file in it (will this cause even the tar file to tarred ?)
sample:
/opt/freeware/bin/tar -cvf - /oracle | gzip > /oracle/backup.tgz
will the tar file backup.tgz also include backup.tgz ?
i tried... (5 Replies)
Hello,
I need to write a script to check directory size on a linux server.
I do not have access to some directories Inside the directory tree so I've got some warning in the output that say :
du : cannot read directory ....
Could you please help me. I did try Inside of my script to... (2 Replies)
i have an application that writes to a directory. let's call the directory:
/var/app/
the permissions of this directory is:
drwxrwxr-x
Now the files that the application creates in this directory usually dont have read permissions for others.
i know there's something called... (3 Replies)
we want to allow user to FTP files into a directory, and then the program (PLSQL) will read and process the file, and then move the file to other directory for archiving.
the user id: uftp1, group: ftp
the program run in oracle database, thus have the user Id: oraprod, group: dba
how to... (2 Replies)
Hi,
How do i check if I have read/write/execute rights on a UNIX directory?
What I'm doing is checking read access on the files but i also want to check if user has rights on the direcory in whcih these files are present.
if then......
And I check if the directory exists by using... (6 Replies)
I want to backup all the directory tress, including hidden directories, without copying any files.
find . -type d gives the perfect list.
When I tried tar, it won't work for me because it tars all the files.
find . -type d | xargs tar -cvf a.tar
So i tried rsync.
On my own test box, the... (4 Replies)
HI,
if I have a tarfile called pmapdata.tar that contains
tar -tvf pmapdata.tar
-rw-r--r-- 0/0 21 Oct 15 11:00 2009 /var/tmp/pmapdata/pmap4628.txt
-rw-r--r-- 0/0 21 Oct 14 20:00 2009 /var/tmp/pmapdata/pmap23752.txt
-rw-r--r-- 0/0 1625 Oct 13 20:00 2009... (1 Reply)
I want to make an automated system to compile & run the source codes from different persons and to tell if the output is the same with the standard one(wich is given by me). Ok, this is quite simple, but the tricky part is,how do I avoid the "bad intentions" that may result from running those... (2 Replies)
From within a directory, how do I determine whether I have write permission for it.
test -w pwd ; echo ?
This doesn't work as it returns false, even though I have write permission. (4 Replies)