LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   tar --exclude for subdirectories (https://www.linuxquestions.org/questions/linux-software-2/tar-exclude-for-subdirectories-107632/)

mrtwice 10-23-2003 12:01 PM

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.

red hat-ziggis 10-23-2003 12:26 PM

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 :D read your figure it out

mrtwice 10-23-2003 12:50 PM

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 :D read your figure it out
Thank you for not contributing at all to this post :D

I am assuming you did not mean to post here?


All times are GMT -5. The time now is 08:04 PM.