<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://infocepo.com/wiki/index.php?action=history&amp;feed=atom&amp;title=CaseFix.sh</id>
	<title>CaseFix.sh - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://infocepo.com/wiki/index.php?action=history&amp;feed=atom&amp;title=CaseFix.sh"/>
	<link rel="alternate" type="text/html" href="https://infocepo.com/wiki/index.php?title=CaseFix.sh&amp;action=history"/>
	<updated>2026-04-27T03:38:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.13</generator>
	<entry>
		<id>https://infocepo.com/wiki/index.php?title=CaseFix.sh&amp;diff=749&amp;oldid=prev</id>
		<title>Tcepo: Created page with &quot;&lt;pre&gt; #!/bin/sh  # Init cachePath=/tmp/duples$$  # store paths find * ./.[^.]* ./..?* -xdev ! -type l |gzip &gt;&quot;${cachePath}&quot;.in.gz  # Convert lower case zcat &quot;${cachePath}&quot;.in....&quot;</title>
		<link rel="alternate" type="text/html" href="https://infocepo.com/wiki/index.php?title=CaseFix.sh&amp;diff=749&amp;oldid=prev"/>
		<updated>2019-10-29T13:28:31Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; #!/bin/sh  # Init cachePath=/tmp/duples$$  # store paths find * ./.[^.]* ./..?* -xdev ! -type l |gzip &amp;gt;&amp;quot;${cachePath}&amp;quot;.in.gz  # Convert lower case zcat &amp;quot;${cachePath}&amp;quot;.in....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Init&lt;br /&gt;
cachePath=/tmp/duples$$&lt;br /&gt;
&lt;br /&gt;
# store paths&lt;br /&gt;
find * ./.[^.]* ./..?* -xdev ! -type l |gzip &amp;gt;&amp;quot;${cachePath}&amp;quot;.in.gz&lt;br /&gt;
&lt;br /&gt;
# Convert lower case&lt;br /&gt;
zcat &amp;quot;${cachePath}&amp;quot;.in.gz |tr '[:upper:]' '[:lower:]' &amp;gt;&amp;quot;${cachePath}&amp;quot;.out2&lt;br /&gt;
&lt;br /&gt;
mv -f &amp;quot;${cachePath}&amp;quot;.out2 &amp;quot;${cachePath}&amp;quot;.in2&lt;br /&gt;
&lt;br /&gt;
# Get duples&lt;br /&gt;
inFile=&amp;quot;${cachePath}&amp;quot;.in2&lt;br /&gt;
outFile=&amp;quot;${cachePath}&amp;quot;.out2&lt;br /&gt;
triggerValue=1&lt;br /&gt;
awk 'NR == FNR {count[$0]++; next}; count[$0] &amp;gt; '&amp;quot;${triggerValue}&amp;quot; &amp;quot;${inFile}&amp;quot; &amp;quot;${inFile}&amp;quot; \&lt;br /&gt;
	| awk '!seen[$0]++' |tee &amp;quot;${outFile}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mv -f &amp;quot;${cachePath}&amp;quot;.out2 &amp;quot;${cachePath}&amp;quot;.in2&lt;br /&gt;
&lt;br /&gt;
# get original duplicates, new in&lt;br /&gt;
zgrep -xi -f &amp;quot;${cachePath}&amp;quot;.in2 &amp;quot;${cachePath}&amp;quot;.in.gz &amp;gt;&amp;quot;${cachePath}&amp;quot;.out2&lt;br /&gt;
rm -f &amp;quot;${cachePath}&amp;quot;.in.gz&lt;br /&gt;
&lt;br /&gt;
mv -f &amp;quot;${cachePath}&amp;quot;.out2 &amp;quot;${cachePath}&amp;quot;.in&lt;br /&gt;
&lt;br /&gt;
# fix&lt;br /&gt;
cat &amp;quot;${cachePath}&amp;quot;.in2 |while read lineMy ;do&lt;br /&gt;
  filePath=&amp;quot;&amp;quot;&lt;br /&gt;
  dirPath=&amp;quot;&amp;quot;&lt;br /&gt;
  zgrep -xi &amp;quot;${lineMy}&amp;quot; &amp;quot;${cachePath}&amp;quot;.in |while read lineMy2 ;do&lt;br /&gt;
    if [ -f &amp;quot;${lineMy2}&amp;quot; ] ;then&lt;br /&gt;
      if [ -z &amp;quot;${filePath}&amp;quot; ] ;then&lt;br /&gt;
        filePath=&amp;quot;${lineMy2}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        dirName=&amp;quot;$(dirname &amp;quot;${filePath}&amp;quot;)&amp;quot;&lt;br /&gt;
        oldName=$(basename &amp;quot;${filePath}&amp;quot; |sed -rn 's#^(.*)\.([^\.]*)|([^\.]+)$#\1\3#p')&lt;br /&gt;
        typeName=$(basename &amp;quot;${filePath}&amp;quot; |sed -rn 's#^(.*)\.([^\.]*)|([^\.]+)$#\2#p')&lt;br /&gt;
      fi&lt;br /&gt;
      md5File=$(md5sum &amp;quot;${lineMy2}&amp;quot; |cut -c1-4 )&lt;br /&gt;
&lt;br /&gt;
      mv -nv &amp;quot;${lineMy2}&amp;quot; &amp;quot;${dirName}/${oldName}.${md5File}.${typeName}&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if [ -z &amp;quot;${dirPath}&amp;quot; ] ;then&lt;br /&gt;
        dirPath=&amp;quot;${lineMy2}&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        mv -vn &amp;quot;${lineMy2}&amp;quot;/* &amp;quot;${lineMy2}&amp;quot;/\.[^\.]* &amp;quot;${lineMy2}&amp;quot;/\.\.?* &amp;quot;${dirPath}&amp;quot;/.&lt;br /&gt;
        rmdir &amp;quot;${lineMy2}&amp;quot;&lt;br /&gt;
      fi&lt;br /&gt;
    fi&lt;br /&gt;
  done&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
rm -rf /tmp/duples$$*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tcepo</name></author>
	</entry>
</feed>