How to include only certain files?

View: New views
2 Messages — Rating Filter:   Alert me  

How to include only certain files?

by Peng Yu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

There is --exclude option. For example,

I can use the following command to exclude *.exe files. But if I only
want *.exe files, how to do it?

tar cjvf abc.tar.bz2 abc --exclude={*.exe}

Regards,
Peng



Re: How to include only certain files?

by Sergey Poznyakoff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Peng Yu <pengyu.ut@...> ha escrit:

> I can use the following command to exclude *.exe files. But if I only
> want *.exe files, how to do it?

Use find:

  find . -name '*.exe' | tar -cjvf abc.tar.bz2 -T - --no-recursion

Regards,
Sergey