From ff8d7183b3110fb56b7eba1f14e38d1e75a02392 Mon Sep 17 00:00:00 2001 From: rakesh kumar Date: Sun, 15 Apr 2018 14:32:35 +0530 Subject: [PATCH] program to delete duplicate files from destination folder --- .gitignore | 3 +++ delete_duplicate.py | 26 ++++++++++++++++++++++++++ multilineUse.py | 2 ++ while_range.py | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 delete_duplicate.py create mode 100644 multilineUse.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7dd1f96 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vscode +/build +/dist diff --git a/delete_duplicate.py b/delete_duplicate.py new file mode 100644 index 0000000..e70780b --- /dev/null +++ b/delete_duplicate.py @@ -0,0 +1,26 @@ +#------------------------------------------------------------------------------- +# Name: delete_duplicate.py +# Purpose: Delete duplicate files in destination folder +## Author: rakesh kumar +## Created: 05-05-2017 +# Copyright: binarynote.com +# Licence: MIT +#------------------------------------------------------------------------------- +import glob +import os +def main(): + source = r'C:\Users\acer\Desktop\python_pdf' + target = r'C:\Users\acer\Desktop\python_pdf1' + os.chdir(source) + file_source = glob.glob('*.*') + os.chdir(target) + files_target=glob.glob('*.*') + count=0 + for filename in files_target: + if filename in file_source : + os.unlink(filename) + count+=1 + + print('Total {} files deteled'.format(count)) +if __name__ == '__main__': + main() diff --git a/multilineUse.py b/multilineUse.py new file mode 100644 index 0000000..1b2e91e --- /dev/null +++ b/multilineUse.py @@ -0,0 +1,2 @@ +i=5 +print(i) \ No newline at end of file diff --git a/while_range.py b/while_range.py index 17b8a09..77d8040 100644 --- a/while_range.py +++ b/while_range.py @@ -16,6 +16,6 @@ elif n==3: print("multiply two numbers") elif n==4: - print("Exit") + valid= i=i+1 print(i) \ No newline at end of file