LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-31-2009, 09:24 AM   #1
pendal
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Rep: Reputation: 0
tar not working as expected


I have this tar command

Code:
tar czvf "/Volumes/Cold_Storage_5/144000-144999/144073.tgz" "/Volumes/COLD STORAGE/144000-144999/144073" --exclude "/Volumes/COLD STORAGE/144000-144999/144073/print drive/*"
when it runs everything gets added to the archive but when it goes to exclude... it gets funky.

here is the terminal output from the exclude part of the command

Code:
tar: --exclude: Cannot stat: No such file or directory
/Volumes/COLD STORAGE/144000-144999/144073/print drive/
/Volumes/COLD STORAGE/144000-144999/144073/print drive/._144073.F1.P2.T1(61).tif
/Volumes/COLD STORAGE/144000-144999/144073/print drive/144073.F1.P2.T1(61).tif
/Volumes/COLD STORAGE/144000-144999/144073/print drive/._144073_F1.P1.T1(60).tif
/Volumes/COLD STORAGE/144000-144999/144073/print drive/144073.F1.P1.T1(60).tif
tar: Error exit delayed from previous errors

the folder i am trying to exclude only has 2 .tif files in it. I understand the the ._ files are hidden ones which is fine, but ...
if i open the .tgz file and look inside the print drive folder and its contents are still in there. There are 8 files in the tar file, but only 4 files show up here.

also, in the section of the tar command where it adds the files only 4 of the 8 are displayed in the output. But ALL 8 show up in the tar file.

can anyone offer a suggestion as to why? or explain to me what I am missing?

All i want to do is compress the directory and exclude the print drive folder and its contents.

Thanks,
Pendal

Last edited by pendal; 07-31-2009 at 09:28 AM.
 
Old 07-31-2009, 09:45 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
From the tar man page:
Quote:
--exclude=PATTERN
exclude files, given as a PATTERN
Aren't you missing the "=" between the option and the pattern?
jdk
 
Old 07-31-2009, 09:49 AM   #3
pendal
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
i was able to eliminate some of the problem at least.
in reference to the twice as many files...

I put --exclude="path/to/exclude"

but i am still getting this at the end..

Code:
tar: --exclude="/Volumes/COLD STORAGE/144000-144999/144073/print drive/*": Cannot stat: No such file or directory
tar: Error exit delayed from previous errors

but here they are being added to the list.
Code:
/Volumes/COLD STORAGE/144000-144999/144073/print drive/
/Volumes/COLD STORAGE/144000-144999/144073/print drive/._144073.F1.P2.T1(61).tif
/Volumes/COLD STORAGE/144000-144999/144073/print drive/144073.F1.P2.T1(61).tif
/Volumes/COLD STORAGE/144000-144999/144073/print drive/._144073.F1.P1.T1(60).tif
/Volumes/COLD STORAGE/144000-144999/144073/print drive/144073.F1.P1.T1(60).tif
at least I got it stop adding it twice.
 
Old 07-31-2009, 10:18 AM   #4
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Jessie (Fluxbox WM)
Posts: 1,388
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
I can explain what is happening, but not why:

1) The error message indicates that it is trying to open "--exclude" as a file, not interpret it as an option.
2) When you had a space it was adding the 'exclude' parameter files both as part of src and as explicitly listed (hence they were included twice).
3) When you had an '=', it now treated the excluded files as part of the filename that began with "--exclude" (and not surprisingly, couldn't find it). So they only got added once as part of src.

Incidentally, it doesn't seem to matter if the '=' is used or not when the exclude is working properly, though that was my first guess too.

A few guesses:
* an old version or non-GNU version of tar? eg Solaris ('tar --version')
* a shell file that is supplying a simplified interface ('whereis tar')
* some problem with quoting (or unclosed quotes)?
* you are actually using --add-file to list the files rather than the command line?
 
Old 07-31-2009, 10:22 AM   #5
pendal
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
ok .. so i looked and the machine has gnu tar 1.15.1

i will attempt to upgrade to the latest version.

although it is a macintosh .. so let's hope for the best.

I'll keep you posted.

-P
 
Old 07-31-2009, 10:36 AM   #6
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Jessie (Fluxbox WM)
Posts: 1,388
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Quote:
ok .. so i looked and the machine has gnu tar 1.15.1
Pretty recent then, only a few years old. Still should handle excludes.

Just as an experiment, try putting the exclude parameter immediately after the tgz filename and see what the outcome is.

Another experiment would be to put a hyphen in front of the 'czvf' flags.

Last edited by neonsignal; 07-31-2009 at 10:38 AM.
 
Old 07-31-2009, 10:52 AM   #7
pendal
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
no dice on either one of those.

I am going to update to the latest version of tar and see what happens then.
 
  


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
posix_memalign, not working as expected. heber.tomer Programming 2 05-23-2009 05:43 AM
S_ISDIR not working as expected. what is going on? zeppelin Programming 8 04-19-2007 11:21 AM
Useradd - not working as expected Paean Solaris / OpenSolaris 13 01-31-2006 05:06 PM
chmod u+s not working as expected clinton Linux - Newbie 3 03-19-2004 08:49 PM
up2date not working as expected johnny13 Linux - Newbie 7 07-21-2003 02:15 PM


All times are GMT -5. The time now is 06:49 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration