From b0e8dbcff0fe11303a9b39df49521aa94c1efc98 Mon Sep 17 00:00:00 2001 From: sritanmay001 Date: Thu, 17 Oct 2019 14:41:45 +0530 Subject: [PATCH 1/2] Added Clean_up_photo --- Clean_up_photo_directory/README.md | 1 + Clean_up_photo_directory/clean_up_photo.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Clean_up_photo_directory/README.md create mode 100644 Clean_up_photo_directory/clean_up_photo.py diff --git a/Clean_up_photo_directory/README.md b/Clean_up_photo_directory/README.md new file mode 100644 index 0000000..1250bfb --- /dev/null +++ b/Clean_up_photo_directory/README.md @@ -0,0 +1 @@ +This program is used to find out the "bad" picture files and then eventually delete them. \ No newline at end of file diff --git a/Clean_up_photo_directory/clean_up_photo.py b/Clean_up_photo_directory/clean_up_photo.py new file mode 100644 index 0000000..79b030f --- /dev/null +++ b/Clean_up_photo_directory/clean_up_photo.py @@ -0,0 +1,20 @@ +import os +from os.path import join +for (dirname, dirs, files) in os.walk('.'): + for filename in files: + if filename.endswith('.txt') : + thefile = os.path.join(dirname,filename) + size = os.path.getsize(thefile) + if size == 2578 or size == 2565: + print 'T-Mobile:',thefile + #os.remove(thefile) Add this when you are sure to delete the file + continue + fhand = open(thefile,'r') + lines = list() + for line in fhand: + lines.append(line) + fhand.close() + if len(lines) == 3 and lines[2].startswith('Sent from my iPhone'): + print 'iPhone:', thefile + #os.remove(thefile) Add this when you are sure to delete the file + continue \ No newline at end of file From 5ef188e3877b220dd633a57f31e7b3dee112175a Mon Sep 17 00:00:00 2001 From: sritanmay001 Date: Thu, 17 Oct 2019 14:58:36 +0530 Subject: [PATCH 2/2] Added clean_up_photo --- Clean_up_photo_directory/README.md | 11 ++++++++++- README.md | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Clean_up_photo_directory/README.md b/Clean_up_photo_directory/README.md index 1250bfb..942c3c2 100644 --- a/Clean_up_photo_directory/README.md +++ b/Clean_up_photo_directory/README.md @@ -1 +1,10 @@ -This program is used to find out the "bad" picture files and then eventually delete them. \ No newline at end of file +# Clean_up_photo + + +## Description + +This program is used to find out the "bad" picture files and then eventually delete them. + +## Usage + +Run the clean_up_photo.py diff --git a/README.md b/README.md index 7ef6576..18b4150 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Awesome Python Scripts :sunglasses: PyPI +# Awesome Python Scripts :sunglasses: PyPI ## What is this repo? This repo is a compilation of some *awesome* Python scripts that automate some boring tasks or simply make our life easier...or both! @@ -71,7 +71,7 @@ So far, the following projects have been integrated to this repo: |[IMDB TV Series Info Extractor](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/imdb_episode_ratings)|[Yash Raj Sarrof](https://github.com/yashYRS) | |[Yoda-speak Translator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/speak_like_yoda)|[sonniki](https://github.com/sonniki) | |[Medium Article Downloader](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/medium_article_downloader)|[coolsonu39](https://github.com/coolsonu39)| - +|[Clean_up_photo](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Clean_up_photo)|[sritanmay001](https://github.com/sritanmy001)| ## How to use : - Clone/Download the directory and navigate to each folder. Or...