#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017 Eduardo Frazão ( https://github.com/fr4z40 )
#
#   Licensed under the MIT License;
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#     https://opensource.org/licenses/MIT
#

from os import walk, stat
from sys import argv
from subprocess import check_output


if len(argv) != 2:
    print('how to use\n%s /full_path/folder/to_check/' % argv[0])
    quit()



def md5sum(file_path):
    rst = ((check_output(('md5sum "%s"' % file_path), shell=True)).decode())
    return(rst.split()[0].strip())



files = {}

for dr in walk(argv[1]):
    for fl in dr[2]:
        fl_path = (('%s/%s' % (dr[0], fl)).replace('//', '/')).strip()
        md5_rst = md5sum(fl_path)
        ctime = stat(fl_path).st_ctime
        if md5_rst not in files:
            files[md5_rst] = [[ctime, fl_path]]
        else:
            files[md5_rst].append([ctime, fl_path])


for key in files.keys():
    if len(files[key]) > 1:
        files[key] = sorted(files[key])
        files[key][0][1] = ('orig_file:'+(files[key][0][1].strip()))
        for item in files[key]:
            print(item[1])

@@ -332,29 +332,8 @@
 tat%0A
-from sys import argv%0A
 from
@@ -368,105 +368,65 @@
 put%0A
-%0A%0Aif len(argv) != 2:%0A    print('how to use%5Cn%25s /full_path/folder/to_check/' %25 argv%5B0%5D)%0A    quit()
+from argparse import ArgumentParser, RawTextHelpFormatter
 %0A%0A%0A%0A
@@ -563,16 +563,360 @@
 p())%0A%0A%0A%0A
+if __name__ == '__main__':%0A%0A    parser = ArgumentParser(formatter_class=RawTextHelpFormatter)%0A    parser.add_argument('path', help='Folder Path', type=str)%0A    parser.add_argument('-d', '--detailed',%0A        help='0 or 1, if seted as 1, will be more verbose, default is 0', type=int)%0A    args = parser.parse_args()%0A%0A%0A    fd_pth = args.path%0A    
 files = 
@@ -919,16 +919,20 @@
 s = %7B%7D%0A%0A
+    
 for dr i
@@ -942,22 +942,25 @@
 alk(
-argv%5B1%5D):%0A
+fd_pth):%0A   
     
+ 
 for 
@@ -972,16 +972,20 @@
  dr%5B2%5D:%0A
+    
         
@@ -1055,16 +1055,20 @@
         
+   
+ 
 md5_rst 
@@ -1085,16 +1085,20 @@
 l_path)%0A
+    
         
@@ -1136,16 +1136,20 @@
         
+   
+ 
 if md5_r
@@ -1165,16 +1165,20 @@
  files:%0A
+    
         
@@ -1229,14 +1229,22 @@
     
+   
+ 
 else:%0A
+    
     
@@ -1297,33 +1297,308 @@
 )%0A%0A%0A
-for key in files.keys():%0A
+    if args.detailed == 1:%0A        out_p = %5B%5D%0A%0A%0A    for key in files.keys():%0A        if args.detailed == 1:%0A            files%5Bkey%5D = sorted(files%5Bkey%5D)%0A            for item in files%5Bkey%5D:%0A                ctm, pth = item%5B0%5D, item%5B1%5D%0A                out_p.append((pth, ctm, key))%0A        else:%0A        
     
@@ -1621,32 +1621,40 @@
 %5D) %3E 1:%0A        
+    
+    
 files%5Bkey%5D = sor
@@ -1661,32 +1661,40 @@
 ted(files%5Bkey%5D)%0A
+        
         files%5Bke
@@ -1746,32 +1746,40 @@
 rip()))%0A        
+    
+    
 for item in file
@@ -1798,16 +1798,24 @@
         
+        
 print(it
@@ -1821,8 +1821,164 @@
 tem%5B1%5D)%0A
+%0A    if args.detailed == 1:%0A        out_p = sorted(set(out_p))%0A        for item in out_p:%0A            print('%25s%7C%25s%7C%25s' %25 (item%5B2%5D, str(item%5B1%5D), item%5B0%5D))%0A%0A

Update chk_dpl.py