Sponsored Content
Top Forums Shell Programming and Scripting Remove Duplicate Filenames in 2 very large directories Post 302356109 by jaysunn on Thursday 24th of September 2009 01:24:18 PM
Old 09-24-2009
Wow,
I realized from your questions that I really did not provide much detail. Thanks for attempting to decipher.

Once the script identifies that there is a duplicate file residing on the /data1 partition I would like to then pass a rm argument to remove the file from /data2 cleaning up space on that partition.


Quote:
Also, is there a directory hierarchy or is there just /data1 and /data2 with no subdirectories?
Yes there is a hierarchy involved. Here is a snippet of it for you. Each partition has a 4 to 6 letter subdirectory that is mirrored on each partition. Files in that structure could be the same.

Code:
/data1/wcnn/*.mp3
/data1/wxxr/*.mp3
/data1/trrn/*.mp3

/data2/wcnn/*.mp3
/data2/wxxr/*.mp3
/data2/trrn/*.mp3

So there may be the same mp3 file in the station abbreviation on /data1 and /data2. I only need that file in one partition.

If I can provide any output commands please let me know.

Jaysunn
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Fastest way to traverse through large directories

Hi! I have thousands of sub-directories, and hundreds of thousands of files in them. What is the fast way to find out which files are older than a certain date? Is the "find" command the fastest? Or is there some other way? Right now I have a C script that traverses through and checks... (5 Replies)
Discussion started by: sreedharange
5 Replies

2. Shell Programming and Scripting

Remove prefix from filenames

I'm trying to put together a shell script that will append specific prefixes based on the content of filenames. I think I have this part down. However, I want to append before that part a process that will remove the current prefix before it renames the files with the new prefix. For example,... (6 Replies)
Discussion started by: HLee1981
6 Replies

3. UNIX for Dummies Questions & Answers

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: bash-2.03# pwd /var/log/cricket bash-2.03# ls -1 | sort |... (2 Replies)
Discussion started by: dangral
2 Replies

4. Shell Programming and Scripting

duplicate directories

Hi, I have file which users like filename ->"readfile", following entries peter john alaska abcd xyz and i have directory /var/ i want to do first cat of "readfile" line by line and first read peter in variable and also cross check with /var/ how many directories are avaialble... (8 Replies)
Discussion started by: learnbash
8 Replies

5. Shell Programming and Scripting

read list of filenames from text file and remove these files in multiple directories

I have a large list of filenames from an Excel sheet, which I then translate into a simple text file. I'd like to use this list, which contains various file extensions , to archive these files and then remove them recursively through multiple directories and subdirectories. So far, it looks like... (5 Replies)
Discussion started by: fxvisions
5 Replies

6. Shell Programming and Scripting

Shellscript to rearrange filenames in directories

below is the script to rename filenames ending with .pdf extension. I want the script to enter directories and search for all pdf and then if it is in the format file_amb_2008.pdf , then change it to 2008_amb_file.pdf, and this script should work only for .pdf files. help required to make the... (12 Replies)
Discussion started by: deaddevil
12 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

Duplicate directories

I have noticed that the same folder (and contents) lives in /u/public and /usr/public Question was this put here intentionally or by accident? Its 31Gb in size and on a 72Gb HDD that leaves little room for apps. It is a nework shared drive for all to access e.g. p: points to... (0 Replies)
Discussion started by: moondogi
0 Replies

9. Shell Programming and Scripting

Remove spaces in filenames

Hi, I have files like below, In files coming as spaces. Before transfering those files into ftp server. I want to remove the spaces and then can transfer the files into unix server. e.g: filenames are 1) SHmail _profile001_20120908.txt 2) SHmail_profile001 _20120908.txt 3) sh... (3 Replies)
Discussion started by: kirankumar
3 Replies

10. Shell Programming and Scripting

Delete duplicate directories?

Is there a way via some bash script or just cmd to find duplicate directories? i have main folders: TEST1 TEST2 In folder TEST1 is some amount of same folders as in folder TEST2 can be this done? i tried fdupe but it only search for dupe files not whle dirs thx! (8 Replies)
Discussion started by: ZerO13
8 Replies
fmemcmp(3)						     Library Functions Manual							fmemcmp(3)

NAME
fmemcmp - fuzzy comparison of two memory areas SYNOPSIS
#include <fstrcmp.h> #define FSTRCMP_IDENTICAL #define FSTRCMP_THRESHOLD #define FSTRCMP_ERROR double fmemcmp(const void *data1, size_t size1, const void *data2, size_t size2); DESCRIPTION
The fmemcmp() function compares the two memory areas, the size1 bytes pointed to by data1 and the size2 bytes pointed to by data2. RETURN VALUE
The fmemcmp function returns a floating point value between 0.0 and FSTRCMP_IDENTICAL. A value of 0.0 means the memory areas are utterly un-alike. A value of FSTRCMP_IDENTICAL means the memory areas are identical. A value of more than FSTRCMP_THRESHOLD (it lies between 0.0 and FSTRCMP_IDENTICAL) would be considered "similar" by most people. A value of FSTRCMP_ERROR (always negative) indicates a malloc(3) failure. SEE ALSO
fmemcmpi(3) fuzzy comparison of two memory areas fstrcmp(3) fuzzy comparison of two strings memcmp(3) compare memory areas COPYRIGHT
fstrcmp version 0.4 Copyright (C) 2009 Peter Miller Peter Miller <pmiller@opensource.org.au> The comparison code is derived from the fuzzy comparison functions in GNU Gettext 0.17. The GNU Gettext comparison functions were, in turn, derived from GNU Diff 2.7. Copyright (C) 1988-2009 Free Software Foundation fmemcmp(3)
All times are GMT -4. The time now is 08:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy