Find the answer to your Linux question:
Results 1 to 3 of 3
I have a directory containg lots of sub-directories which are numbers sequentially. I am trying to tar up a selection of them, for instance folders 1002 to 10053. How would ...
  1. #1
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845

    Tar a range of files

    I have a directory containg lots of sub-directories which are numbers sequentially. I am trying to tar up a selection of them, for instance folders 1002 to 10053.

    How would I tar up files between to ranges?

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    one way is to put the names of what you want included
    into a file F, and then use tar's "-T, --files-from F
    get names to extract or archive from file F" option;
    and as the names are sequential, you can use seq:

    seq 1002 10053>F; tar -T F cf new.tar

    you might try it with a small F at first
    the sun is new every day (heraclitus)

  3. #3
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Had to edit you version a bit to:

    seq 1000 1050 >F; tar cf newfile.tar -T F; rm F

    but thanks for pointing me in the right direction

Posting Permissions

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