LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-29-2005, 11:42 AM   #1
GATTACA
Member
 
Registered: Feb 2002
Location: USA
Distribution: Fedora, CENTOS
Posts: 209

Rep: Reputation: 32
tar --exclude-from=FILE


I'm trying to get tar to pack up only certain files in a directory.

I my approach is that I have a file in my home space called .skip_files (<- note the dot at the beginnig of name).

Anyway lets say a directory contains the following:

file1.txt
file2.txt
avoid1.txt
avoid2.txt
extra-directory-1
extra-directory-2
avoid-directory-1

I want tar to include in a tarball everything that does not contain "avoid" in its name. Now in ~/.skip_files I've added the names of the files and directories I want to skip

When I execute: tar -czvf stuff.tar.gz --exclude-from=~/.skip_files target_directory

it never works.

I've tried variations of the command such as:
tar -czf stuff.tar.gz --exclude-from=~/.skip_files target_directory
tar -czf stuff.tar.gz target_directory --exclude-from=~/.skip_files

I'm sure there is a simple solution to this problem I just can see it.

Any suggestions?
 
Old 07-29-2005, 12:25 PM   #2
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
In your command, "~" isn't expanded. You told us you mean your home directory, so use either of
Code:
--exclude-from ~/.skip_files
--exclude-from=$HOME/.skip_files
As written, .skip_files would need to sit in a local sub-directory by the name "~".
 
  


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 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
tar --exclude for subdirectories mrtwice Linux - Software 2 10-23-2003 12:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:25 AM.

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