From 08ad68bccee236b999eca72f07e8b90b2ef9c2e6 Mon Sep 17 00:00:00 2001 From: iwontheboot Date: Fri, 25 Oct 2019 16:39:56 -0400 Subject: [PATCH] Finished check_dup --- .DS_Store | Bin 0 -> 6148 bytes check_dup/.DS_Store | Bin 0 -> 6148 bytes check_dup/README.md | 15 +++++ check_dup/check_dup.py | 142 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 .DS_Store create mode 100644 check_dup/.DS_Store create mode 100644 check_dup/README.md create mode 100755 check_dup/check_dup.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8bc93005dfb6c4e874e64a23422339a8df63c11f GIT binary patch literal 6148 zcmeHK%}&BV5S~TUEyl>fM2>s$#sLEA$)rI%cr&TdgBoZpkw$C@6p13Huc2?`6ZksL z>@G%wUOX5>W|G-&c7ArVUz_~_0MQtQRe&M@NL0d{gUvTWand=-Sr4JmW86RsLKs0m z7|&(1<3BP$-_C(6=t2kEPv39Y4|+*}(bu5gi-u{X@+NXi`Q?>WDGRc&UbytS$=FN% zbTn-EgLCQ~`)N0@_DPcTK5RcYjXL92aq}RFQ$LD316>@29Zb16i{daDHS5Zp1(Gow3?GP`mzt7{@yr2I zRijBf;**{`h`On0bo@mIf z5;BJyvgp{` 1: + checkPrompt(fiFound, pathF) + + else: + # Only the files directly in the directory + for files in os.listdir(checkDir): + fiFound = [] + pathF = checkDir + "/" + files + pathF1 = pathF.replace(" ","\\ ") + if os.path.isfile(pathF): + if pathF in dontCheck: + continue + # Check files with themselves + for selif in os.listdir(checkDir): + pathD = checkDir + "/" + selif + pathD1 = pathD.replace(" ","\\ ") + cmd = "diff {} {}".format(pathF1,pathD1) + if os.path.isfile(pathD): + k = subprocess.call(cmd, shell=True, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL) + if k == 0: + fiFound.append(pathD) + + if len(fiFound) > 1: + checkPrompt(fiFound, pathF) + print() + + +print("Duplicate Remover v1.0") +print("++ exit|stop|quit to stop script ++") +print() + +x = "X" +while x != "y" and x != "n": + x = input("Would you like to check directories within directories? (y/n) ") + if x == "exit" or x == "stop" or x == "quit": + bye = "X" + while bye != "y" and bye != "n": + bye = input("Exit? (y/n) ") + if bye == "y": + print("Goodbye!") + exit() + +if x == "y": + dirdir = True +else: + dirdir = False + +print() + +while True: + dontCheck.clear() + # Prompt inputs (ask which directory to search) + print("Pick a directory: ", end="") + checkDir = input() + + # If exit, ask if they want to exit, else check dir + if checkDir == "exit" or checkDir == "stop" or checkDir == "quit": + bye = "X" + while bye != "y" and bye != "n": + bye = input("Exit? (y/n) ") + if bye == "y": + print("Goodbye!") + exit() + + # Check if directory exists + if os.path.isdir(checkDir): + checkDup(checkDir, dirdir) + else: + print("Directory {} not found... (try pwd from the directory you want to check) \n".format(checkDir)) + continue