Files count mismatch when used with Tar with find


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Files count mismatch when used with Tar with find
# 8  
Old 12-01-2011
Quote:
Originally Posted by rakeshkumar
are there any other tools which are used for archiving in linux apart from TAR? because i see if tar is been interrupted while processing then that resultant archive is unusable so is there any way to avoid this or any other tools better than "tar "
I don't know of any archiver program on any OS which reacts well to being summarily killed without warning. Dead is dead, incomplete is incomplete.

No matter what archiver you use, your script ought to be checking the return value of it to see whether it succeeded or failed and what to do about it.
Quote:
i have observed that slight change in memory usage

after tar , i have checked usage after extracting the tar.gz and its (du folder) :11049124

compared it using
Code:
find ./ -type f -mtime +7 -name "*.00*" -exec du  {} \;| awk '{s+=$1} END {print "Total SIZE: " s}'

it gave a total of 11048212

the difference is 912 bytes , so are there any header added ?? could any one explain why ?
du doesn't give you exact file sizes, it tells you how much disk was used. or "du" for short.
Code:
$ echo asdf > tinyfile
$ du -h tinyfile
4.0K    emptyfile
$

Obviously "asdf" doesn't take 4 kilobytes, but my filesystem has a 4 kilobyte cluster size, so no file takes less than 4 kilobytes of disk.

So any difference in how the files are fragmented, for example, could change these numbers, even though the files themselves remain identical in length and content.

Sparse files can make this even more wacky:

Code:
$ ls -lh 01-part
-r-------- 1 username cdrom 233G Aug 22 12:52 01-part
$ du -hs 01-part
27G     01-part
$

sparse files have large "holes", sections full of NULLs which aren't actually stored on disk. ls has no way to inform you of this, but du can tell.

---------- Post updated at 11:10 AM ---------- Previous update was at 10:20 AM ----------

Unless you tell it not to, du reports in blocks, not bytes, by the way.

Last edited by Corona688; 12-01-2011 at 12:27 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find Syllable count mismatch

Hello, I have written a syllable splitter for Pseudo English and Indic. I have a large database with the following structure Syllables in Pseudo English delimited by |=Syllables in Devanagari delimited by | The tool produces syllables in both scripts. An example is given below: ... (2 Replies)
Discussion started by: gimley
2 Replies

2. Shell Programming and Scripting

awk to output match and mismatch with count using specific fields

In the below awk I am trying output to one file those lines that match between $2,$3,$4 of file1 and file2 with the count in (). I am also trying to output those lines that are missing between $2,$3,$4 of file1 and file2 with the count of in () each. Both input files are tab-delimited, but the... (7 Replies)
Discussion started by: cmccabe
7 Replies

3. Shell Programming and Scripting

Count mismatch in UNIX

Hi, I have a requirement like below. client is sending the .txt filles.In that file we have 10 records but when I execute the below command it is showing 9 records. klena20> wc -l sample_file.txt|awk '{print $1}' It is showing the output as 9 But in a file records are 10. I found... (7 Replies)
Discussion started by: kirankumar
7 Replies

4. Shell Programming and Scripting

Find *.tar files under all subdirectories

Hi there, I'm new to shell scripting... I've a situation like to find *.tar files under all subdirectories in "/home/abcd" and i used the below, find /opt/lhapp ! -name "temp" | more the above works fine.. Now don't need search few direcotries like "/home/abcd/aaaa",... (15 Replies)
Discussion started by: skcvasanth
15 Replies

5. Shell Programming and Scripting

find files older than and containing then tar.

I'm tring to: find files recursively older than x days that contain dat or DAT then tar them I can find the files older than 90 days containing dat with this: find . -mtime +90 -type f -name "*dat*" -exec tar -cvvfp /some/path/some.tar {} \; but how do I do it case insensitive? ... (3 Replies)
Discussion started by: Ikon
3 Replies

6. UNIX for Dummies Questions & Answers

Count number of compressed files in a tar.gz archive

Hi Folks, I have a tar.gz compressed file with me, and I want to know the number of files in the archive without uncompressing it. Please let me know how I can achieve it. Regards RK Veluvali (5 Replies)
Discussion started by: vrk1219
5 Replies

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

8. Shell Programming and Scripting

To find String mismatch

Hi, I have a doubt when searching files for the existence of a particular key. I have a property file has data with key and value pair like below and i call it as property file.ini here are the contents in File: popertyfile.ini location.property=2 agent.method=begin newkey=23 ... (2 Replies)
Discussion started by: raghu.amilineni
2 Replies

9. Shell Programming and Scripting

comparing two files and find mismatch

hi i have two files and i want to compare both the files and find out mismatch in 3rd file file1 00354|1|0|1|1|0|0|0|1|2 52424|1|0|1|1|0|0|0|1|2 43236|1|0|1|1|0|0|0|1|2 41404|1|0|1|1|0|0|0|1|2 79968|1|0|1|1|0|0|0|1|2 file2 00354|1|0|1|1|0|0|0|1|2 52424|1|0|1|1|0|0|0|0|2... (9 Replies)
Discussion started by: dodasajan
9 Replies

10. UNIX for Dummies Questions & Answers

find a data from several .tar,.gz files

Hi I have a several files with .tar or .gz in a known location. i have files with one of the several files of .tar or .gz text.txt help.pl move.txt how do i write a script to find out those particular files .tar or .gz where that contains the above mentioned files (i.e,... (2 Replies)
Discussion started by: gkrishnag
2 Replies
Login or Register to Ask a Question