- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Another Question About Tar
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 04:32 AM
11-06-2003 04:32 AM
If I want to tar a directory but leave out a specific subdirectory within it, what would the correct syntax be? Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 04:36 AM
11-06-2003 04:36 AM
Re: Another Question About Tar
I would do something like the following:
# cd /dir/to/tar
# ls -1 >> ../filename
# vi ../filename
(Do this and remove the directory that you want to skip)
# tar -xvf /path/to/file.tar $(cat ../filename)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 04:48 AM
11-06-2003 04:48 AM
Re: Another Question About Tar
# tar -cvf /path/to/tar.file $(cat /path/to/test)
I encountered the following error:
Illegal variable name.
What did I miss?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 04:55 AM
11-06-2003 04:55 AM
Re: Another Question About Tar
try
tar -cvf /path/to/tar.file `cat /path/to/test`
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 05:02 AM
11-06-2003 05:02 AM
Re: Another Question About Tar
I tried the syntax
tar -cvf /path/to/tar.file `cat /path/to/test`
and got the error:
Cannot add file cat /home/ahk/test: No such file or directory
I also tried
tar -cvf /path/to/tar.file cat'/path/to/test`
and got the following:
Cannot add file cat /home/ahk/test: No such file or directory
Removing leading '/' from absolute path names in the archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 05:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 05:41 AM
11-06-2003 05:41 AM
Re: Another Question About Tar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2003 05:48 AM
11-06-2003 05:48 AM
Re: Another Question About Tar
tar -cvf /tmp2/vbe/find_test -C $(find . -print|grep -v
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2003 03:03 AM
11-10-2003 03:03 AM
Re: Another Question About Tar
(cd /d2tar ; tar cvf /dev/rmt/0m `ls -1a |grep -vE '^\.$|^\.\.$|^exd1$|^exd2$' ` )
. the "1" lists one per line.
. the "a" is to force "." files to be printed, like ".profile". Depending on the Unix version, they may not show up without it -- e.g., certain Linux.
. the grep's -v excludes lines and -E allows expressions.
. the ^...$ means match entire name from beginning of line to end of line.
. here we exclude 2 directories, "exd1" and "exd2" (the "|" meaning "or").
. finally, the ^\.$|^\.\.$ excludes the "." and ".." that show up in a 'ls -1a' listing (which are current directory and parent directory).
bv