crasch (crasch) wrote,
crasch
crasch

GEEK: How to tar up a list of filenames



Suppose you have a file named "files.txt" that contains the following list of filenames:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation

If you want to tar up the actual files you can do so with this command:

cat files.txt | xargs tar cvzf files.tgz

cat - displays the contents of files.txt
| - pipes the output of cat to xargs
xargs - reads the filenames passed to it by cat, and executes tar with them as arguments
c - create tar file
v - verbose
z - gzip the resulting tar file
f - write to file
files.tgz - the name of the file
Tags: geek, programming, tar
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 9 comments