Sponsored Content
Top Forums UNIX for Dummies Questions & Answers tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file Post 302302918 by zaxxon on Wednesday 1st of April 2009 10:55:50 AM
Old 04-01-2009
Basically it should be no problem. Maybe depending which version of tar you use. I am on Debian using GNU tar for this example:
Code:
$> find . -type d -name "dir[0-9]"
./dir1
./dir2
$> tar cvf bla.tar `find . -type d -name "dir[0-9]" -print`
./dir1/
./dir1/subdir1/
./dir1/.ssh/
./dir1/.ssh/somekey
./dir1/subdir2/
./dir2/
./dir2/subdir1/
./dir2/subdir2/
$> tar tvf bla.tar
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/subdir1/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/.ssh/
-rw-r--r-- root/root         0 2009-03-30 11:35 ./dir1/.ssh/somekey
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir1/subdir2/
drwxr-xr-x root/root         0 2009-03-30 11:38 ./dir2/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir2/subdir1/
drwxr-xr-x root/root         0 2009-03-30 11:35 ./dir2/subdir2/


Make sure that your is showing the files you want, ie. maybe write it like this
Code:
# 1st:
find . -mtime -1 -type f -print
# If output is the files you want, 2nd:
tar -cvf test.tar `find . -mtime -1 -type f -print`

 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

using TAR -cvf test.tar "HELP"

Ok, I use the command tar -cvf /home/output/test.tar /home/input on one UNIX server, lets call it sneezy. I FTP the tared file over to another server, lets call it bashful. Use the tar -xvf test.tar command and get a error indicating that it is looking for the same directory as where the... (3 Replies)
Discussion started by: wev
3 Replies

2. UNIX for Dummies Questions & Answers

using Tar -cvf file.tar "Need Help"

Ok, I use the command tar -cvf ~kw4691/output/test.tar ~kw4691/input on one UNIX server, lets call it sneezy. I FTP the tared file over to another server, lets call it bashful. Use the tar -xvf test.tar command and get the error ~kw4691/input "could not create the directory" /hom/dev/sy40... (7 Replies)
Discussion started by: wev
7 Replies

3. UNIX for Advanced & Expert Users

Does tar do crc checking on a tape or tar file?

Trying to answer a question about whether tar table-of-contents is a good tool for verifying tape data. (1 Reply)
Discussion started by: tjlst15
1 Replies

4. UNIX for Dummies Questions & Answers

shortcut for tar cvf - [filename] | gzip > [filename].tar.gz

i'd like to have an alias (or something similar) where i can type a command like "archive" and a filename and have it tar and gzip the file, so... $ archive filename results in filename.tar.gz...do i have to write a script to do this? (4 Replies)
Discussion started by: bcamp1973
4 Replies

5. UNIX for Advanced & Expert Users

Tar utility (untar a .tar file) on VxWorks

Hi All Can someone pls guide me if there any utility to compress file on windows & uncompress on vxworks I tried as - - compressed some folders on windows ... i created .tar ( to maintain directory structure ) and compressed to .gz format. - on VxWorks i have uncompressed it to .tar... (1 Reply)
Discussion started by: uday_01
1 Replies

6. Shell Programming and Scripting

Bus error while using command tar -cvf

Hi, I am working on a mac OSX machine. I am getting bus error :confused: when i use the command tar -cvf file1.tar file1 What could be the reason for this?? (1 Reply)
Discussion started by: shweeths
1 Replies

7. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

8. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

9. AIX

Tar - pre-checking before making the Tar file

Coming from this thread, just wondering if there is an option to check if the Tar of the files/directory will be without any file-errors without actually making the tar. Scenario: Let's say you have a directory of 20GB, but you don't have the space to make Tar file at the moment, and you want... (14 Replies)
Discussion started by: filosophizer
14 Replies
virt-tar-out(1) 					      Virtualization Support						   virt-tar-out(1)

NAME
virt-tar-out - Pack a virtual machine disk image directory into a tarball. SYNOPSIS
virt-tar-out -a disk.img /dir files.tar virt-tar-out -d domain /dir files.tar virt-tar-out -d domain /dir - | gzip --best > files.tar.gz DESCRIPTION
"virt-tar-out" packs a virtual machine disk image directory into a tarball. The first parameter is the absolute path of the virtual machine directory. The second parameter is the tar file to write. Use "-" to write to standard output. EXAMPLES
Download the home directories from a guest: virt-tar-out -d MyGuest /home - | gzip --best > homes.tar.gz JUST A SHELL SCRIPT WRAPPER AROUND GUESTFISH
This command is just a simple shell script wrapper around the guestfish(1) "tar-out" command. For anything more complex than a trivial copy, you are probably better off using guestfish directly. OPTIONS
Since the shell script just passes options straight to guestfish, read guestfish(1) to see the full list of options. SEE ALSO
guestfish(1), virt-cat(1), virt-copy-in(1), virt-copy-out(1), virt-edit(1), virt-tar-in(1), <http://libguestfs.org/>. AUTHORS
Richard W.M. Jones ("rjones at redhat dot com") COPYRIGHT
Copyright (C) 2011 Red Hat Inc. <http://libguestfs.org/> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. libguestfs-1.18.1 2013-12-07 virt-tar-out(1)
All times are GMT -4. The time now is 11:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy