tar contains duplicate filenames


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers tar contains duplicate filenames
# 1  
Old 03-14-2007
tar contains duplicate filenames

I have a problem where tar is somehow creating duplicate filenames when tarring a directory. Doing an ls on the directory does not show any duplicate filenames, yet when the directory is tarred, you can see that there are duplicates:

Code:
bash-2.03# pwd
/var/log/cricket
bash-2.03# ls -1 | sort | uniq -d
bash-2.03# tar cvf /tmp/ctar.tar . >/dev/null
bash-2.03# tar tvf /tmp/ctar.tar | awk '{ print $NF }' | sort | uniq -d
./cricket24b.10
./cricket24b.79
bash-2.03# tar tvf /tmp/ctar.tar | grep ./cricket24b.10
-rw-r--r--   0/1    13328 Mar 13 01:42 2007 ./cricket24b.100
-rw-r--r--   0/1    13330 Mar 14 09:42 2007 ./cricket24b.10
-rw-r--r--   0/1    13331 Mar 14 09:57 2007 ./cricket24b.10
bash-2.03# ls -l /var/log/cricket/cricket24b.10
-rw-r--r--   1 root     other      13331 Mar 14 09:57 /var/log/cricket/cricket24b.10
bash-2.03# date
Wed Mar 14 12:30:11 EDT 2007

# 2  
Old 03-14-2007
Are there hard links?
# 3  
Old 03-14-2007
Quote:
Originally Posted by jim mcnamara
Are there hard links?
There are no hard links, at least not for this specific file

-rw-r--r-- 1 root other 13331 Mar 14 09:57 /var/log/cricket/cricket24b.10

The link count=1

Are you really suie we are dealing with duplicate file names?

It could be that 1 file actually has the name as you see it. The other one could contain non printable characters in its name, which makes it look as if the file has the same name.


You could try the command:

Code:
ls -l /var/log/cricket | grep "Mar 14 09:"

and see if it looks like duplicate names pop up.

If this is the case you can try the command:

Code:
ls -lb /var/log/cricket | grep "Mar 14 09:"

which should show the file names actually differ.

This is all assuming the time stamps of the files haven't changed.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

Find duplicate based on 'n' fields and mark the duplicate as 'D'

Hi, In a file, I have to mark duplicate records as 'D' and the latest record alone as 'C'. In the below file, I have to identify if duplicate records are there or not based on Man_ID, Man_DT, Ship_ID and I have to mark the record with latest Ship_DT as "C" and other as "D" (I have to create... (7 Replies)
Discussion started by: machomaddy
7 Replies

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

4. Shell Programming and Scripting

tar cmd how many arguments into parameters of filenames

Hi I would like to use tar cmd in my script. I have a variable with filenames, e.g. 1000 records and I would like to paste its values into tar cmd. For this example I used three elements variable strings. strings="file1.txt file2.txt file3.txt" `tar cf file1.tar $strings` Whether... (1 Reply)
Discussion started by: presul
1 Replies

5. Shell Programming and Scripting

Help with adding to tar filenames

Hi there, i have been working on a backup script and have it just about working, the only problem im left with is that my filenames for my backups are all the same are replacing one another when backing up. currently i have BACKUP_FILE=backup_$(date +%d%m%y).tgz but would like something like... (2 Replies)
Discussion started by: Swinton
2 Replies

6. Shell Programming and Scripting

Remove Duplicate Filenames in 2 very large directories

Hello Gurus, O/S RHEL4 I have a requirement to compare two linux based directories for duplicate filenames and remove them. These directories are close to 2 TB each. I have tried running a: Prompt>diff -r data1/ data2/ I have tried this as well: jason@jason-desktop:~$ cat script.sh ... (7 Replies)
Discussion started by: jaysunn
7 Replies

7. Shell Programming and Scripting

Find duplicate filenames and remove in different mount point

Hi Gurus, Do any kind souls encounter have the same script as mentioned here. Find and compare filenames in different mount point and remove duplicates. Thanks a million!!! wanna13e (7 Replies)
Discussion started by: wanna13e
7 Replies

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

9. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

10. 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
Login or Register to Ask a Question