From 40add9841a3380f95b0d120a238f205b54337735 Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:29:08 +0530 Subject: [PATCH 1/8] Create file_search.py --- File_Search/file_search.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 File_Search/file_search.py diff --git a/File_Search/file_search.py b/File_Search/file_search.py new file mode 100644 index 00000000..68421c35 --- /dev/null +++ b/File_Search/file_search.py @@ -0,0 +1,23 @@ +import pathlib +jpg_files_path = pathlib.Path('Place the folder path here under quotes') +file_paths = [] + +for file in jpg_files_path.rglob('*'): + if file.is_file(): + file_paths.append(str(file)) + +formatted_output = '[\n' + ',\n'.join(f' "{path}"' for path in file_paths) + '\n]' +print(formatted_output) + + +file_extensions = [] + +for file in jpg_files_path.rglob('*'): + if file.is_file(): + ext = file.suffix.lower() + if ext and ext not in file_extensions: + file_extensions.append(ext) + + +formattedd_output = '[\n' + ',\n'.join(f' "{ext}"' for ext in file_extensions) + '\n]' +print(formattedd_output) From 95736eaf085992f02e34add76b680d3035bee8a8 Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:39:58 +0530 Subject: [PATCH 2/8] Create readme.md --- File_Search/readme.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 File_Search/readme.md diff --git a/File_Search/readme.md b/File_Search/readme.md new file mode 100644 index 00000000..da5f8a45 --- /dev/null +++ b/File_Search/readme.md @@ -0,0 +1,35 @@ +File Path Finder and Unique Extension Lister +This Python script searches a specified folder for all files, regardless of file type, within its directory and subdirectories. It outputs the paths of all files found and also lists all unique file extensions present in the folder. The script uses Python's pathlib module, which is cross-platform and simplifies working with file paths. + +Features: +File Path Finder: The script scans a folder and lists the file paths of all files it finds within the specified directory and its subdirectories. +Unique File Extension Lister: The script identifies all unique file extensions present in the folder, displaying them in lowercase format. + +Requirements: Python 3.x + +Set the Folder Path: + +Replace 'Place the folder path here under quotes' in the script with the path to the folder you want to scan: +jpg_files_path = pathlib.Path('path/to/your/folder') + +Run the Script: + +Save the script as file_finder.py (or another name of your choice). + +Open your terminal or command prompt. + +Navigate to the folder containing the script and run it with: + +python file_finder.py + +Output: + +The script will output two lists: +The first list contains the paths of all files found within the specified folder and its subdirectories. +The second list contains all unique file extensions in the folder, displayed in lowercase. + + +Example output: + +[ "path/to/folder/document.txt", "path/to/folder/image.jpg", "path/to/folder/subfolder/script.py"] +[ ".txt", ".jpg", ".py"] From db6c0c931910f5f3b5ad433bddc9ad6da4edc2ae Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:40:37 +0530 Subject: [PATCH 3/8] Update file_search.py --- File_Search/file_search.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/File_Search/file_search.py b/File_Search/file_search.py index 68421c35..e0b8321f 100644 --- a/File_Search/file_search.py +++ b/File_Search/file_search.py @@ -1,8 +1,8 @@ import pathlib -jpg_files_path = pathlib.Path('Place the folder path here under quotes') +all_files_path = pathlib.Path('Place the folder path here under quotes') file_paths = [] -for file in jpg_files_path.rglob('*'): +for file in all_files_path.rglob('*'): if file.is_file(): file_paths.append(str(file)) @@ -12,7 +12,7 @@ file_extensions = [] -for file in jpg_files_path.rglob('*'): +for file in all_files_path.rglob('*'): if file.is_file(): ext = file.suffix.lower() if ext and ext not in file_extensions: From 7b50e09266481020cca2887deb5a42c39eb480bb Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:41:51 +0530 Subject: [PATCH 4/8] Update readme.md --- File_Search/readme.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/File_Search/readme.md b/File_Search/readme.md index da5f8a45..6cc85ea2 100644 --- a/File_Search/readme.md +++ b/File_Search/readme.md @@ -10,20 +10,16 @@ Requirements: Python 3.x Set the Folder Path: Replace 'Place the folder path here under quotes' in the script with the path to the folder you want to scan: -jpg_files_path = pathlib.Path('path/to/your/folder') +all_files_path = pathlib.Path('path/to/your/folder') Run the Script: Save the script as file_finder.py (or another name of your choice). - Open your terminal or command prompt. - Navigate to the folder containing the script and run it with: - python file_finder.py Output: - The script will output two lists: The first list contains the paths of all files found within the specified folder and its subdirectories. The second list contains all unique file extensions in the folder, displayed in lowercase. From 3b06b53c053e5081cd8fb23296d28b486df90bf1 Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:42:09 +0530 Subject: [PATCH 5/8] Update readme.md --- File_Search/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/File_Search/readme.md b/File_Search/readme.md index 6cc85ea2..462f0611 100644 --- a/File_Search/readme.md +++ b/File_Search/readme.md @@ -1,4 +1,4 @@ -File Path Finder and Unique Extension Lister +File Path Finder and Unique Extension Lister: This Python script searches a specified folder for all files, regardless of file type, within its directory and subdirectories. It outputs the paths of all files found and also lists all unique file extensions present in the folder. The script uses Python's pathlib module, which is cross-platform and simplifies working with file paths. Features: From 9984c6b8f63950bb9aa0cf5d883bb2e8c9d25520 Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:47:41 +0530 Subject: [PATCH 6/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 97710f02..efc0baaa 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ Weight Converter | [Weight Converter](https://github.com/Wa | Word to PDF | [Word to PDF](https://github.com/DhanushNehru/Python-Scripts/tree/master/Word%20to%20PDF%20converter) | A Python script to convert an MS Word file to a PDF file. | | Youtube Downloader | [Youtube Downloader](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Downloader) | Downloads any video from [YouTube](https://youtube.com) in video or audio format! | Youtube Playlist Info Scraper | [Youtube Playlist Info Scraper](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Playlist%20Info%20Scraper) | This python module retrieve information about a YouTube playlist in json format using playlist link. +| File Search | [File_search](https://github.com/debojit11/Python-Scripts/tree/master/File_Search) | A python script that searches a specified folder for all files, regardless of file type, within its directory and subdirectories. ## Gitpod From aa92be99d9acc4bc8287be3c2bd59bc36cf486fc Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:48:11 +0530 Subject: [PATCH 7/8] improved the heading in readme.md --- File_Search/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/File_Search/readme.md b/File_Search/readme.md index 462f0611..597c155e 100644 --- a/File_Search/readme.md +++ b/File_Search/readme.md @@ -1,4 +1,4 @@ -File Path Finder and Unique Extension Lister: +Automated File Explorer: This Python script searches a specified folder for all files, regardless of file type, within its directory and subdirectories. It outputs the paths of all files found and also lists all unique file extensions present in the folder. The script uses Python's pathlib module, which is cross-platform and simplifies working with file paths. Features: From cb3a0cbcb9d8519b5db5b91293a5abafb226648c Mon Sep 17 00:00:00 2001 From: debojit11 <126899332+debojit11@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:50:09 +0530 Subject: [PATCH 8/8] placed the name , link and description in correct row --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index efc0baaa..d340ab88 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ More information on contributing and the general code of conduct for discussion | Face Reaction | [Face Reaction](https://github.com/DhanushNehru/Python-Scripts/tree/master/Face%20Reaction) | A script which attempts to detect facial expressions. | | Fake Profiles | [Fake Profiles](https://github.com/DhanushNehru/Python-Scripts/tree/master/Fake%20Profile) | Creates fake profiles. | | File Encryption Decryption | [File Encryption Decryption](https://github.com/DhanushNehru/Python-Scripts/tree/master/File%20Encryption%20Decryption) | Encrypts and Decrypts files using AES Algorithms for Security purposes. | +| File Search | [File_search](https://github.com/debojit11/Python-Scripts/tree/master/File_Search) | A python script that searches a specified folder for all files, regardless of file type, within its directory and subdirectories. | Font Art | [Font Art](https://github.com/DhanushNehru/Python-Scripts/tree/master/Font%20Art) | Displays a font art using Python. | | Freelance Helper Program | [freelance-helper](https://github.com/DhanushNehru/Python-Scripts/tree/master/freelance-help-program) | Takes an Excel file with working hours and calculates the payment. | | Get Hexcodes From Websites | [Get Hexcodes From Websites](https://github.com/DhanushNehru/Python-Scripts/tree/master/Get%20Hexcodes%20From%20Websites) | Generates a Python list containing Hexcodes from a website. | @@ -135,7 +136,6 @@ Weight Converter | [Weight Converter](https://github.com/Wa | Word to PDF | [Word to PDF](https://github.com/DhanushNehru/Python-Scripts/tree/master/Word%20to%20PDF%20converter) | A Python script to convert an MS Word file to a PDF file. | | Youtube Downloader | [Youtube Downloader](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Downloader) | Downloads any video from [YouTube](https://youtube.com) in video or audio format! | Youtube Playlist Info Scraper | [Youtube Playlist Info Scraper](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Playlist%20Info%20Scraper) | This python module retrieve information about a YouTube playlist in json format using playlist link. -| File Search | [File_search](https://github.com/debojit11/Python-Scripts/tree/master/File_Search) | A python script that searches a specified folder for all files, regardless of file type, within its directory and subdirectories. ## Gitpod