dannyman.toldme.com


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:
Previous:
Categories: FreeBSD, Technical

Discover more from dannyman.toldme.com

Subscribe now to keep reading and get access to the full archive.

Continue reading