View Single Post
  #8 (permalink)  
Old 06-15-2008, 12:50 PM
jellybean stonerfish
Tablet PC Guest
 
Posts: n/a
Re: tar --remove-files

On Sun, 15 Jun 2008 15:50:08 +0200, Philipp Ghirardini wrote:

On Sun, 15 Jun 2008 15:50:08 +0200, Philipp Ghirardini wrote:

> J.O. Aho wrote:
>> Philipp Ghirardini wrote:
>>> hi!
>>>
>>> I have the following problem:
>>>
>>> I want to pack all files in a special directory except some particular
>>> ones and delete them afterwards. The files shall be in the archive
>>> without subdirectories.
>>>
>>> I have the following tar command:
>>>
>>> tar --remove-files -C /net_tests/tests/dir_one -czf
>>> /net_tests/tests/dir_one/myzip.tar.gz . --exclude=file3
>>> --exclude=myzip.tar.gz
>>>
>>>
>>> Actually it does exactly what I want but it returns 2 and not 0
>>> because of the following reason:
>>>
>>> tar: .: Cannot rmdir: Invalid argument tar: Error exit delayed from
>>> previous errors
>>>
>>>
>>> I think the problem is that the command is packing the '.' and so it
>>> is trying to remove it what fails of course.

>>
>> I think the tar is trying to delete dir_one, it could be better you
>> switch to the directory in question, run the command (without the
>> paths), think that will result in a 0.
>>
>>
>>

> Thanks for your fast reply.
>
> I think I'm doing that with the command -C. I jump into the directory
> '/net_tests/tests/dir_one' There I perform the packing on all files
> located '.'.
>
> I now tried to change the directory by hand and perform the following
> command:
>
> tar --remove-files -czf myzip.tar.gz . --exclude=file3
> --exclude=myzip.tar.gz
>
> but got the same result.
>
> regards Philipp


Did you do * here when you changed to this directory by hand? It seems
to work for me. Also have you played with --strip or --strip-components?

js@blackbox:~/test$ ls -l
total 12
-rw-r--r-- 1 js js 29 2008-06-15 12:09 apple -rw-r--r-- 1 js js 24
2008-06-15 12:09 banana -rw-r--r-- 1 js js 139 2008-06-15 12:11
test.tar.gz

js@blackbox:~/test$ tar --remove-files -czf test.tar.gz * \
--exclude=banana --exclude=test.tar.gz

js@blackbox:~/test$ ls -l
total 8
-rw-r--r-- 1 js js 24 2008-06-15 12:09 banana -rw-r--r-- 1 js js 139
2008-06-15 12:16 test.tar.gz

js@blackbox:~/test$ tar -f test.tar.gz -t apple

Reply With Quote

 
Old 06-15-2008, 12:50 PM
Xploder HD Movie Player for PS3. Manage, convert and transfer media files between the PC and PS3.