Sponsored Content
Full Discussion: 'find' and 'tar' combination
Top Forums Shell Programming and Scripting 'find' and 'tar' combination Post 302164831 by kharen11 on Wednesday 6th of February 2008 03:17:50 AM
Old 02-06-2008
'find' and 'tar' combination

I'm trying to tar the files I get from the 'find' command result. However I can't make it run successfuly? This is for our archiving process.

Here is my script:
find /mnt/LOGS -mtime -10 -name "TUXLOG.*" -exec tar -cvf /mnt/LOGS/combine.tar {} \;

Im not sure why it is not working or it is even possible to use the 'tar' command with exec.

Appreciate your help.
 

10 More Discussions You Might Find Interesting

1. Solaris

Combination of gunzip and tar on Solaris

Hello I'm trying to use a combination of gunzip and tar to unpack and unzip a *.tar.gz file. I tried gunzip ~/myfile.tar.gz | gtar -x This will unzip the file, but it won't unpack. Any hints? thanks a lot Dan (5 Replies)
Discussion started by: dwidmer
5 Replies

2. UNIX for Dummies Questions & Answers

Problem with find and tar

When I am doing the first command the result shows all the files, links, directories except the ones that contain the word logs find . -type f -o -type l -o -type d | grep -v logs But when I am trying to do this even the logs are getting tarred tar -cvf fdtvision.tar `find . -type f -o -type l... (2 Replies)
Discussion started by: venu_nbk
2 Replies

3. UNIX for Dummies Questions & Answers

Combination of find -xargs & wc -l

Dear all, I have to calculate sum of record count of files of the specified directory. First I tried the following way which prints one or more outputs. How can I sum of this output? find /home/work/tmp/1/O/ -type f -print0 | xargs -0 wc -l | grep total 1666288 total 1073908 total ... (4 Replies)
Discussion started by: mr_bold
4 Replies

4. UNIX for Dummies Questions & Answers

Grep and find combination

Hello All, I'm trying the following:find . -name "*" -exec grep -ln "IsAlpha" {} \; It gives me file names only (having string "IsAlpha"), I want to get line numbers also, something like this: test 1: Line 52 test 1: Line 95 etc Is it possible to obtain using grep & find only. (5 Replies)
Discussion started by: nervous
5 Replies

5. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

6. 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

7. Shell Programming and Scripting

Complex find and replace only 1st instance string with dynamic combination

test.txt is the dynamic file but some of combination are fix like below are the lines ;wonder_off = ;wonder_off = disabled wonder_off = wonder_off = disabled the test.txt can content them in any order #cat test.xt ;wonder_off = ;wonder_off = disabled wonder_off = wonder_off =... (5 Replies)
Discussion started by: SilvesterJ
5 Replies

8. Shell Programming and Scripting

Find and Tar a Folder

Hi all, I have created a function that looks for a folder in a particular directory, checks the date it was last modified and if its old then compress it. This works fine for files using gzip. However for folders I had to use tar. This is my function: compressOldFolder() { # $1 is... (10 Replies)
Discussion started by: TasosARISFC
10 Replies

9. Shell Programming and Scripting

Using find for variable combination of perms

Hi, I'm trying to use find in kshell (AIX) to find all files with perms of write for other AND any execute bit set. e.g: r--r-x-w- would qualify and rw-rw--wx would qualify but ---rwxr-xr-x wouldn't qualify So far, I've been trying something like this: find . -type f -perm... (4 Replies)
Discussion started by: alanp36
4 Replies

10. UNIX for Beginners Questions & Answers

Need help ASAP - FIND - TAR - GZIP

Hi, I need to combined in 1 line the execution below : find * -type f -mtime -$nb_days -print | xargs tar -cvf $MAITUT/BCK_DATA.tar gzip $MAITUT/BCK_DATA.tar.gz The fact that the TAR is very big, at the end I need to generate only the GZ file. The option z on the tar... (2 Replies)
Discussion started by: royinfo.alain
2 Replies
pwd(1T) 						       Tcl Built-In Commands							   pwd(1T)

__________________________________________________________________________________________________________________________________________________

NAME
pwd - Return the absolute path of the current working directory SYNOPSIS
pwd _________________________________________________________________ DESCRIPTION
Returns the absolute path name of the current working directory. EXAMPLE
Sometimes it is useful to change to a known directory when running some external command using exec, but it is important to keep the appli- cation usually running in the directory that it was started in (unless the user specifies otherwise) since that minimises user confusion. The way to do this is to save the current directory while the external command is being run: set tarFile [file normalize somefile.tar] set savedDir [pwd] cd /tmp exec tar -xf $tarFile cd $savedDir SEE ALSO
file(1T), cd(1T), glob(1T), filename(1T) KEYWORDS
working directory ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTcl | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tcl is available on http://opensolaris.org. Tcl pwd(1T)
All times are GMT -4. The time now is 05:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy