Results 1 to 4 of 4

Thread: tar question - include only *.py files

  1. #1
    Join Date
    Jan 2008
    Location
    Henners, happy Henners
    Beans
    41

    tar question - include only *.py files

    Hi - sorry, this isn't really programming talk but I couldn't figure out where else to put it.. I have a bit of a crisis going on and need to tar up all files that match a pattern in a directory tree; I figured out excluding stuff but aren't sure on including only files that match a pattern. Could someone please put me out of my misery! Thanks in advance.

  2. #2
    Join Date
    May 2005
    Location
    Lecce, Italy
    Beans
    6,168
    Distro
    Ubuntu

    Re: tar question - include only *.py files

    Try this:
    Code:
    tar -cvvf foo.tar ~/*.py
    or
    Code:
    tar -cvvf foo.tar your_directory/*.py

  3. #3
    Join Date
    Jan 2008
    Location
    Henners, happy Henners
    Beans
    41

    Re: tar question - include only *.py files

    That half worked.. though I need to go down into the directory tree and find all the *.py's there too; this restricts to current directory.. how can I make it descend? Thanks for your help so far.

  4. #4
    Join Date
    Jan 2008
    Location
    Henners, happy Henners
    Beans
    41

    [SOLVED] Re: tar question - include only *.py files

    Code:
    find . -name \*.py|xargs tar cvfz osp.tar.gz
    That worked.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •