LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-23-2003, 12:01 PM   #1
mrtwice
Member
 
Registered: Feb 2002
Distribution: xubuntu 8.10
Posts: 225

Rep: Reputation: 31
tar --exclude for subdirectories


I have read three posts and the man page for gnu tar and still can not figure out how to do this. Here is my directory structure:
Code:
(monitor):root 0# find phpmon/
phpmon/
phpmon/images
phpmon/images/logo.gif
phpmon/images/edit.gif
phpmon/dont_need
phpmon/dont_need/socktest.php
phpmon/dont_need/xml-stuff.php
phpmon/dont_need/init.new.php
phpmon/dont_need/newinit.php
phpmon/dont_need/regtest.php
phpmon/dont_need/class_path_parser
phpmon/dont_need/class_path_parser/class_path_parser.php
phpmon/dont_need/class_path_parser/foo.xml
phpmon/dont_need/class_path_parser/main.css
phpmon/dont_need/add_host.php
phpmon/index.php
phpmon/view_xml.php
phpmon/mon.css
phpmon/maps
phpmon/maps/Clinton
phpmon/maps/KnobNoster
phpmon/maps/LaMonte
phpmon/maps/Marshall
phpmon/maps/Pilot-Grove
phpmon/maps/Sedalia
phpmon/maps/Warrensburg
phpmon/maps/Warsaw
phpmon/view_hosts.php
phpmon/upgrades.txt
phpmon/build
phpmon/build/mon.cf
phpmon/build/config
phpmon/build/config/tempfile
phpmon/view_services.php
phpmon/send_command.php
phpmon/service_settings.php
phpmon/host_settings.php
phpmon/config
phpmon/config/host_config.xml
phpmon/config/blank.xml
phpmon/config/host_config.xml.bak
phpmon/config/all_services.xml
phpmon/city_settings.php
phpmon/add_remove_city.php
phpmon/view_logs.php
phpmon/view_config.php
phpmon/smarty-class
[...]
This command tars everything:
Code:
tar -czv  -f phpmon.tar.gz phpmon/
Now, I want to tar this directory excluding the phpmon/config directory. This command will work, but it also excludes the phpmon/build/config directory :
Code:
tar -czv --exclude "config" -f phpmon.tar.gz phpmon/
I have tried all of these commands and none work:
Code:
tar -czv -f phpmon.tar.gz ./phpmon --exclude='./phpmon/config/'
tar -czv -f phpmon.tar.gz ./phpmon --exclude phpmon/config
tar -czv -f phpmon.tar.gz ./phpmon --exclude ./phpmon/config
tar -czv -f phpmon.tar.gz /var/www/html/phpmon --exclude /var/www/html/phpmon/config
tar -czv -f phpmon.tar.gz phpmon --exclude phpmon/config*
tar -czv -f phpmon.tar.gz /var/www/html/phpmon --exclude var/www/html/phpmon/config
I am really at a loss. I can't believe it would be this difficult.
 
Old 10-23-2003, 12:26 PM   #2
red hat-ziggis
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Rep: Reputation: 0
dont worry we will all survive remember the 64 and tandys and 386 on doss that was hard to lern too but we did because we had too now that windows that makes os for dummies lol and we kinda got spoiled rember that true power is the commands not the mouse read your figure it out
 
Old 10-23-2003, 12:50 PM   #3
mrtwice
Member
 
Registered: Feb 2002
Distribution: xubuntu 8.10
Posts: 225

Original Poster
Rep: Reputation: 31
Quote:
Originally posted by red hat-ziggis
dont worry we will all survive remember the 64 and tandys and 386 on doss that was hard to lern too but we did because we had too now that windows that makes os for dummies lol and we kinda got spoiled rember that true power is the commands not the mouse read your figure it out
Thank you for not contributing at all to this post

I am assuming you did not mean to post here?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tar won't exclude directories. yougene Slackware 9 12-01-2005 09:32 AM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
tar --exclude-from=FILE GATTACA Programming 1 07-29-2005 12:25 PM
tar exclude-from drisay Slackware 1 12-23-2004 01:10 PM
Exclude directories when backing up with 'tar'? wolfpeach Linux - Newbie 2 06-28-2004 10:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration