dannyman.toldme.com

About Me : Free Style : Good Reads : News and Reaction : Photographs : Technical : Travels : Unsorted

Search:
September 14, 2004
FreeBSD, Technical

HOWTO: Create a Tar Archive From a File List

I had a list of files that someone requested. I wanted to put them in a tar archive, but the tar on the box doesn’t have an option to add a list of files. Huh. Well, this is quick and dirty, and will choke if you have any space in the filenames, but it met my purposes:

[root /root]# cat manifest.txt
/usr/bin/top
/usr/bin/slocate
/bin/login
/bin/xlogin
/bin/ls
/usr/bin/find
/usr/bin/dir
/usr/sbin/lsof
/usr/bin/md5sum
/sbin/syslogd
/usr/bin/pstree
[root /root]# tar cfvz forhans.tar.gz `cat manifest.txt`
tar: Removing leading `/' from member names
bin/ps
sbin/ifconfig
bin/netstat
usr/bin/top
usr/bin/slocate
bin/login
tar: /bin/xlogin: Cannot stat: No such file or directory
bin/ls
usr/bin/find
usr/bin/dir
tar: /usr/sbin/lsof: Cannot stat: No such file or directory
usr/bin/md5sum
sbin/syslogd
usr/bin/pstreetar: Error exit delayed from previous errors
[root /root]# tar tfvz forhans.tar.gz
-r-xr-xr-x root/root     60080 2000-03-07 12:03:26 bin/ps
-rwxr-xr-x root/root     49488 2000-06-13 20:14:25 sbin/ifconfig
-rwxr-xr-x root/root     80632 2000-06-13 20:14:25 bin/netstat
-r-xr-xr-x root/root     34896 2000-03-07 12:03:26 usr/bin/top
-rwxr-sr-x root/slocate  27052 2003-12-24 05:21:35 usr/bin/slocate
-rwxr-xr-x root/root     21672 2002-07-30 10:14:02 bin/login
-rwxr-xr-x root/root     47052 2003-12-27 06:00:42 bin/ls
-rwxr-xr-x root/root     54544 2000-02-02 15:43:28 usr/bin/find
-rwxr-xr-x root/root     47052 2003-12-27 06:00:42 usr/bin/dir
-rwxr-xr-x root/root     14844 2000-02-07 07:50:27 usr/bin/md5sum
-rwxr-xr-x root/root     27112 2000-09-26 21:03:21 sbin/syslogd
-rwxr-xr-x root/root     11376 2000-02-04 22:03:22 usr/bin/pstree

Read More

Next: Make RealPlayer Suck Less
Previous: Dealing with Business Bullies
Categories: FreeBSD, Technical
Possibly-Related Posts
WARNING: PermitRootLogin defaults to “yes”
Install Red Hat via Serial Console
HOWTO: Audit User Crontabs
Dad and Dinners
Vanilla Coke
pkgwhich == rpm -qf
Typing Names

Responses

September 15th, 2004

Brian

cpio can make tar files, and it takes lists :)

March 3rd, 2005

Michael

I need a .tar made for me, but sadly I’m on Windows.
Is there any chance that there’s a program that will create one for me on Windows, or is there anyone out there that will create one out of my file (It’s about 22 megs uncompressed) and send it back?
Thanks ^.^

– Michael

June 6th, 2008

Rick

Michael,

You probably don’t need this any more (3 years later), but for those who might find this through Google (as I did), this may come in handy.

You’ll need some sort of Unix-y command substitute (e.g. cygwin), but you’ve probably already got it since you’re trying to use tar. Anyways, this will do it for you:

touch my.tar && cat my.manifest | xargs tar rvf my.tar

Works for me!

Comment / Tip

. . . or leave a Tip

Leave a comment . . .

  1. For private messages, e-mail me: dannyman@toldme.com
  2. I will not publish or share your e-mail address.
  3. I will not spam you.
  4. Therefor: no anonymous posts; send me your e-mail address!
(required)
(required)

. . . comments from new posters will be held for screening.

Danny Howard is 100% responsible for the content on this site, except some of it is stolen.

All rights are reserved, unless otherwise noted. Generally, I'm a BSD guy, so you can assume implicit permission to adapt, modify, and redistribute my intellectual property with appropriate attribution. Except some of this content is itself re-appropriated, so you'd best ask first, especially for commercial use. Thanks!

You can contact me via e-mail: dannyman@toldme.com

Most of http://dannyman.toldme.com/ is powered by WordPress.

If you're hip to RSS and whatnot, you can subscribe to this site.

These links are for dannyman: login AND backlinks