<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Finding duplicate filenames in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594797#M854552</link>
    <description>&lt;BR /&gt;And the winner is....Vrijhoeven&lt;BR /&gt;&lt;BR /&gt;His answer handles spaces in file and director names (very important!) but needs some massaging to be complete;&lt;BR /&gt;&lt;BR /&gt;1. cd &lt;DIR&gt; ; find . -print &amp;gt; /tmp/tempfile&lt;BR /&gt;2. for i in $(find . -type f | awk -F / '{print $NF}'|sort|uniq -d)&lt;BR /&gt;do&lt;BR /&gt;grep "/${i}" /tmp/tempfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Tested it, works great.&lt;BR /&gt;&lt;/DIR&gt;</description>
    <pubDate>Mon, 15 Oct 2001 10:51:35 GMT</pubDate>
    <dc:creator>Stefan Farrelly</dc:creator>
    <dc:date>2001-10-15T10:51:35Z</dc:date>
    <item>
      <title>Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594791#M854546</link>
      <description>I'd like to find all files with the same names in a given filesystem. The difficulty is that I don't know what the filenames are - could be anything. Also, the files could live in dozens of different directories. Is there a way of listing all duplicate files with full paths to where they are ? &lt;BR /&gt;Many thanks in advance. &lt;BR /&gt;</description>
      <pubDate>Mon, 15 Oct 2001 09:53:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594791#M854546</guid>
      <dc:creator>Preet Dhillon</dc:creator>
      <dc:date>2001-10-15T09:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594792#M854547</link>
      <description>Hi Preet:&lt;BR /&gt;&lt;BR /&gt;to list duplicate names:&lt;BR /&gt;&lt;BR /&gt;find . type f | awk -F / '{ print $NF }' | sort | uniq -d&lt;BR /&gt;&lt;BR /&gt;hope this will help</description>
      <pubDate>Mon, 15 Oct 2001 10:23:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594792#M854547</guid>
      <dc:creator>G. Vrijhoeven</dc:creator>
      <dc:date>2001-10-15T10:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594793#M854548</link>
      <description>Preet,&lt;BR /&gt;&lt;BR /&gt;Give this a try&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;if [ $# -ne 1 ]&lt;BR /&gt;then&lt;BR /&gt;echo "$0: full path to the directory/filesystem"&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;DIR=$1&lt;BR /&gt;&lt;BR /&gt;if [ ! -d $DIR  ]&lt;BR /&gt;then&lt;BR /&gt;echo "$DIR no such directory"&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ -f duplicates ]&lt;BR /&gt;then&lt;BR /&gt;rm duplicates&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;find $DIR -type f &amp;gt; list$$&lt;BR /&gt;awk '{FS="/";print $NF}' list$$ |sort |uniq -d &amp;gt;&amp;gt;  files$$&lt;BR /&gt;for  FILE in `cat files$$`&lt;BR /&gt;do&lt;BR /&gt;grep $FILE list$$ &amp;gt;&amp;gt; tmp$$&lt;BR /&gt;for  ENTRY in `cat tmp$$`&lt;BR /&gt;do&lt;BR /&gt;ONE=`echo $ENTRY|awk '{FS="/";print $NF}'`                     &lt;BR /&gt;if [ $ONE = $FILE ]                                            &lt;BR /&gt;then                                                           &lt;BR /&gt;echo $ENTRY &amp;gt;&amp;gt; duplicates                                      &lt;BR /&gt;fi                                                             &lt;BR /&gt;done                                                           &lt;BR /&gt;done                                                           &lt;BR /&gt;                                                               &lt;BR /&gt;rm tmp$$ files$$ list$$                                        &lt;BR /&gt;echo "Check the file  "duplicates" in the current dir"&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 15 Oct 2001 10:24:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594793#M854548</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-15T10:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594794#M854549</link>
      <description>I think you best start with a "find" and put the output in a textfile. Then you can work on the textfile to find duplicate filesnames.&lt;BR /&gt;&lt;BR /&gt;The find command looks like this :&lt;BR /&gt;find &lt;FILESYSTEM_MOUNTPOINT&gt; -print &amp;gt; filenames.txt&lt;BR /&gt;&lt;BR /&gt;With 'sed', you can covert this file to a list of filenames without path and the patch itself on the same line. Then sort this file.&lt;/FILESYSTEM_MOUNTPOINT&gt;</description>
      <pubDate>Mon, 15 Oct 2001 10:26:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594794#M854549</guid>
      <dc:creator>Wim Rombauts</dc:creator>
      <dc:date>2001-10-15T10:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594795#M854550</link>
      <description>Preet,&lt;BR /&gt;&lt;BR /&gt;You can cut and paste my script. It gives the full paths to the duplicate files in a file called "duplicates" in the current directory.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 15 Oct 2001 10:29:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594795#M854550</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-15T10:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594796#M854551</link>
      <description>&lt;BR /&gt;This will "GRAB" the file name from the path, put the file name first, and then the directory after it. That way you get what you waht, duplicate files in different directories.&lt;BR /&gt;&lt;BR /&gt;find /var -type f|sed "s/\(^\/.*\/\)\(.*$\)/\2 \1/"|sort &amp;gt;filenames.out</description>
      <pubDate>Mon, 15 Oct 2001 10:32:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594796#M854551</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-15T10:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594797#M854552</link>
      <description>&lt;BR /&gt;And the winner is....Vrijhoeven&lt;BR /&gt;&lt;BR /&gt;His answer handles spaces in file and director names (very important!) but needs some massaging to be complete;&lt;BR /&gt;&lt;BR /&gt;1. cd &lt;DIR&gt; ; find . -print &amp;gt; /tmp/tempfile&lt;BR /&gt;2. for i in $(find . -type f | awk -F / '{print $NF}'|sort|uniq -d)&lt;BR /&gt;do&lt;BR /&gt;grep "/${i}" /tmp/tempfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Tested it, works great.&lt;BR /&gt;&lt;/DIR&gt;</description>
      <pubDate>Mon, 15 Oct 2001 10:51:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594797#M854552</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2001-10-15T10:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594798#M854553</link>
      <description>Maybe this is a start. I think this does what you want. It lists *all* files, but it lists the duplicate ones first.&lt;BR /&gt;&lt;BR /&gt;$ cat ../doit&lt;BR /&gt;#! /usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;find . -type f |&lt;BR /&gt;{&lt;BR /&gt;  while read filename&lt;BR /&gt;  do&lt;BR /&gt;        echo `dirname $filename` `basename $filename`&lt;BR /&gt;  done&lt;BR /&gt;} | sort -k 2,2&lt;BR /&gt;&lt;BR /&gt;$ ls -R&lt;BR /&gt;dir1  dir2  dir3&lt;BR /&gt;&lt;BR /&gt;./dir1:&lt;BR /&gt;a  c  d&lt;BR /&gt;&lt;BR /&gt;./dir2:&lt;BR /&gt;a  b  e&lt;BR /&gt;&lt;BR /&gt;./dir3:&lt;BR /&gt;b  c  f&lt;BR /&gt;&lt;BR /&gt;$ ../doit&lt;BR /&gt;./dir1 a&lt;BR /&gt;./dir2 a&lt;BR /&gt;./dir2 b&lt;BR /&gt;./dir3 b&lt;BR /&gt;./dir1 c&lt;BR /&gt;./dir3 c&lt;BR /&gt;./dir1 d&lt;BR /&gt;./dir2 e&lt;BR /&gt;./dir3 f&lt;BR /&gt;:;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; sort -k 2,2</description>
      <pubDate>Mon, 15 Oct 2001 10:59:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594798#M854553</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2001-10-15T10:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594799#M854554</link>
      <description>Not to point out but...&lt;BR /&gt;&lt;BR /&gt;Winner's script doesn't work in this scenario.&lt;BR /&gt;My directory structure is&lt;BR /&gt;&lt;BR /&gt;.                   &lt;BR /&gt;./test1             &lt;BR /&gt;./test1/test        &lt;BR /&gt;./test1/sri         &lt;BR /&gt;./test2             &lt;BR /&gt;./test2/test        &lt;BR /&gt;./test2/new         &lt;BR /&gt;./test3             &lt;BR /&gt;./test3/test        &lt;BR /&gt;./test3/sri         &lt;BR /&gt;./file&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 15 Oct 2001 11:02:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594799#M854554</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-15T11:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594800#M854555</link>
      <description>OOPS! Typos!&lt;BR /&gt;Please ignore the stuff after "./dir3 f", i.e. the silly ":;" and the standalone "sort -k 2,2 ". &lt;BR /&gt;</description>
      <pubDate>Mon, 15 Oct 2001 11:13:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594800#M854555</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2001-10-15T11:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594801#M854556</link>
      <description>&lt;BR /&gt;oops, change the last grep to;&lt;BR /&gt;&lt;BR /&gt;grep "${i}$" /tmp/tempfile&lt;BR /&gt;&lt;BR /&gt;This will find the filenames at the end of the line. Works with the above test1,2,3 directory structure now.&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Oct 2001 11:59:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594801#M854556</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2001-10-15T11:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594802#M854557</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;This method avoids having to run find twice:&lt;BR /&gt;&lt;BR /&gt;===========================================&lt;BR /&gt;find . -type f | while read file ; do&lt;BR /&gt; echo $(dirname "$file")'\t'$(basename "$file")&lt;BR /&gt;done |&lt;BR /&gt;sort -t"    " -k 2 - &amp;gt; /tmp/listfiles&lt;BR /&gt;uniq -f 1 -u /tmp/listfiles |&lt;BR /&gt;join -t"    " -v 2 -1 2 -2 2 -o 2.1,2.2 - /tmp/listfiles |&lt;BR /&gt;sed 's+ +/+'&lt;BR /&gt;=============================================&lt;BR /&gt;&lt;BR /&gt;Both join and sort commands have the tab character between the double quotes.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Mon, 15 Oct 2001 12:22:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594802#M854557</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-10-15T12:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594803#M854558</link>
      <description>Hey Robin,&lt;BR /&gt;&lt;BR /&gt;you sure your script works with spaces in a directory and filename ? usually dirname and basename dont work with spaces in names.</description>
      <pubDate>Mon, 15 Oct 2001 12:27:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594803#M854558</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2001-10-15T12:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594804#M854559</link>
      <description>Hi Stefan,&lt;BR /&gt;&lt;BR /&gt;Seems OK, as long as it's quoted.&lt;BR /&gt;&lt;BR /&gt;# basename /tmp/a b c&lt;BR /&gt;# NOTHING !!&lt;BR /&gt;&lt;BR /&gt;# dirname "/tmp/a b c"&lt;BR /&gt;/tmp&lt;BR /&gt;# basename "/tmp/a b c"&lt;BR /&gt;a b c&lt;BR /&gt;&lt;BR /&gt;I tried a few variations, and it seemed to behave itself.&lt;BR /&gt;&lt;BR /&gt;Cheers, Robin.</description>
      <pubDate>Mon, 15 Oct 2001 12:36:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594804#M854559</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-10-15T12:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594805#M854560</link>
      <description>...and there's a tab between the 1st pair of "+" characters in the final sed...Robin</description>
      <pubDate>Mon, 15 Oct 2001 12:56:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594805#M854560</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-10-15T12:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594806#M854561</link>
      <description>&lt;BR /&gt;Thanks for checking that Robin. OK, now we have 2 answers which do the business. &lt;BR /&gt;&lt;BR /&gt;Preet - dont forget to assign points.&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Oct 2001 13:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594806#M854561</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2001-10-15T13:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594807#M854562</link>
      <description>Here is a perl script (attachment) I found that will actually find DUPLICATE files, and not just duplicate file names.&lt;BR /&gt;&lt;BR /&gt;credits:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.geocities.com/fcheck2000/download.html" target="_blank"&gt;http://www.geocities.com/fcheck2000/download.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Oct 2001 10:59:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-duplicate-filenames/m-p/2594807#M854562</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-17T10:59:01Z</dc:date>
    </item>
  </channel>
</rss>

