Google Groups Home
Help | Sign in
recursively tar the files in a directory
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  21 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
zhengquan  
View profile
(1 user)  More options May 7, 6:40 pm
Newsgroups: comp.unix.shell
From: zhengquan <zhang.zhengq...@gmail.com>
Date: Wed, 7 May 2008 15:40:43 -0700 (PDT)
Local: Wed, May 7 2008 6:40 pm
Subject: recursively tar the files in a directory
Hello,
I want to recursively tar the files that are bigger than 100M in a
directory and delete the original files.
Can any one give me a hint how to do it?

Thanks for your help!

Regards,
Zhengquan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mo  
View profile
(1 user)  More options May 7, 8:47 pm
Newsgroups: comp.unix.shell
From: mo <inva...@mail.address>
Date: Wed, 07 May 2008 21:47:27 -0300
Local: Wed, May 7 2008 8:47 pm
Subject: Re: recursively tar the files in a directory
On Wed, 07 May 2008 19:40:43 -0300, zhengquan <zhang.zhengq...@gmail.com>  
wrote:

> Hello,
> I want to recursively tar the files that are bigger than 100M in a
> directory and delete the original files.
> Can any one give me a hint how to do it?

> Thanks for your help!

> Regards,
> Zhengquan

Maximum compression with bzip2:
find /dir -type f -size +100M|tar cjvf /tmp/file.tar.bz2 -T -

To list content:
tar tjvf /tmp/file.tar.bz2

Then, if ok, delete files is easy.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave B  
View profile
(1 user)  More options May 8, 4:56 am
Newsgroups: comp.unix.shell
From: Dave B <da...@addr.invalid>
Date: Thu, 08 May 2008 10:56:37 +0200
Local: Thurs, May 8 2008 4:56 am
Subject: Re: recursively tar the files in a directory
On Thursday 8 May 2008 00:40, zhengquan wrote:

> Hello,
> I want to recursively tar the files that are bigger than 100M in a
> directory and delete the original files.
> Can any one give me a hint how to do it?

> Thanks for your help!

> Regards,
> Zhengquan

If you have GNU find, xargs and tar, you can do something like

find /srcdir -type f -size +100M -print0 | xargs -r0 \
tar --remove-files -cSjvf tarfile.tbz2

I suggest you try first without the "--remove-files" option.

--
D.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
zhengquan  
View profile
 More options May 8, 3:47 pm
Newsgroups: comp.unix.shell
From: zhengquan <zhang.zhengq...@gmail.com>
Date: Thu, 8 May 2008 12:47:00 -0700 (PDT)
Subject: Re: recursively tar the files in a directory
On May 8, 3:56 am, Dave B <da...@addr.invalid> wrote:

I was not clear in the original post, Can I have a separate tarball
for each file?

Thanks!
Zhengquan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
zhengquan  
View profile
 More options May 8, 5:28 pm
Newsgroups: comp.unix.shell
From: zhengquan <zhang.zhengq...@gmail.com>
Date: Thu, 8 May 2008 14:28:27 -0700 (PDT)
Local: Thurs, May 8 2008 5:28 pm
Subject: Re: recursively tar the files in a directory
On May 8, 3:56 am, Dave B <da...@addr.invalid> wrote:

Can I have the individual files tarred to separate tarballs in the
same directory as the original ones?

Thanks!
Zhengquan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mallin.shetland  
View profile
 More options May 8, 8:04 pm
Newsgroups: comp.unix.shell
From: "mallin.shetland" <mallin.shetl...@aol.com>
Date: Fri, 09 May 2008 02:04:19 +0200
Local: Thurs, May 8 2008 8:04 pm
Subject: Re: recursively tar the files in a directory
zhengquan scrisse:

> I want to recursively tar the files that are bigger than 100M in a
> directory and delete the original files.

find /srcdir -type f -size +100M -print0 |
  tar -cjf archive.tar.bz2 --remove-files --null -T -

It works for GNU tar, don't ask for others.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mallin.shetland  
View profile
 More options May 8, 8:08 pm
Newsgroups: comp.unix.shell
From: "mallin.shetland" <mallin.shetl...@aol.com>
Date: Fri, 09 May 2008 02:08:24 +0200
Local: Thurs, May 8 2008 8:08 pm
Subject: Re: recursively tar the files in a directory
Dave B scrisse:

> find /srcdir -type f -size +100M -print0 | xargs -r0 \
> tar --remove-files -cSjvf tarfile.tbz2

If you have more than one or two hundreds of files
you repeatly overwrite tarfile.tbz2 again and again
and more again; very smart :(

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mallin.shetland  
View profile
(1 user)  More options May 8, 8:20 pm
Newsgroups: comp.unix.shell
From: "mallin.shetland" <mallin.shetl...@aol.com>
Date: Fri, 09 May 2008 02:20:17 +0200
Local: Thurs, May 8 2008 8:20 pm
Subject: Re: recursively tar the files in a directory
zhengquan scrisse:

>  Can I have the individual files tarred to separate tarballs?

Yes

find $dir -type f -size +100M -exec tar --remove-files -cjf {}.tar.bz2 {} \;


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave B  
View profile
(1 user)  More options May 9, 3:57 am
Newsgroups: comp.unix.shell
From: Dave B <da...@addr.invalid>
Date: Fri, 09 May 2008 09:57:04 +0200
Local: Fri, May 9 2008 3:57 am
Subject: Re: recursively tar the files in a directory
On Friday 9 May 2008 02:08, mallin.shetland wrote:

> Dave B scrisse:

>> find /srcdir -type f -size +100M -print0 | xargs -r0 \
>> tar --remove-files -cSjvf tarfile.tbz2

> If you have more than one or two hundreds of files
> you repeatly overwrite tarfile.tbz2 again and again
> and more again; very smart :(

Correct. That's why I suggested the OP to try the command without
the --remove-files option first.

--
D.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Teo  
View profile
 More options May 9, 4:37 am
Newsgroups: comp.unix.shell
From: Teo <matteo.co...@gmail.com>
Date: Fri, 9 May 2008 01:37:15 -0700 (PDT)
Local: Fri, May 9 2008 4:37 am
Subject: Re: recursively tar the files in a directory
Hi

> > > Hello,
> > > I want to recursively tar the files that are bigger than 100M in a
> > > directory and delete the original files.
> > > Can any one give me a hint how to do it?

> > If you have GNU find, xargs and tar, you can do something like

> > find /srcdir -type f -size +100M -print0 | xargs -r0 \
> > tar --remove-files -cSjvf tarfile.tbz2

> > I suggest you try first without the "--remove-files" option.

> Can I have the individual files tarred to separate tarballs in the
> same directory as the original ones?

wait: you want to make tar archivea with one file? Or do you just want
to compress large files in your directory tree?

Matteo


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
zhengquan  
View profile
 More options May 9, 10:41 am
Newsgroups: comp.unix.shell
From: zhengquan <zhang.zhengq...@gmail.com>
Date: Fri, 9 May 2008 07:41:52 -0700 (PDT)
Local: Fri, May 9 2008 10:41 am
Subject: Re: recursively tar the files in a directory
On May 8, 7:20 pm, "mallin.shetland" <mallin.shetl...@aol.com> wrote:

> zhengquan scrisse:

> >  Can I have the individual files tarred to separate tarballs?

> Yes

> find $dir -type f -size +100M -exec tar --remove-files -cjf {}.tar.bz2 {} \;

Thank you, that is exactly what I had hoped.
Zhengquan

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
zhengquan  
View profile
 More options May 9, 10:43 am
Newsgroups: comp.unix.shell
From: zhengquan <zhang.zhengq...@gmail.com>
Date: Fri, 9 May 2008 07:43:20 -0700 (PDT)
Local: Fri, May 9 2008 10:43 am
Subject: Re: recursively tar the files in a directory
On May 9, 3:37 am, Teo <matteo.co...@gmail.com> wrote:

The simulation data is too huge so I just want to compress them to the
original directory and delete the original huge files.

Zhengquan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.