├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── ai_cleanup-program ├── README.md ├── config.json ├── main.py ├── maintenance.py ├── nlp.py ├── start.bat └── ui.py ├── naz-doc-sorter ├── README.md ├── sort_docs.py ├── start.bat └── start.sh ├── naz-file-sorter-lite ├── README.md ├── organize_files_by_type.py ├── start.bat └── start.sh ├── naz-file-sorter ├── README.md ├── sort_files.py ├── start.bat └── start.sh ├── naz-precision-classification-sorter ├── README.md ├── sort-with-precision.py ├── start_cpu.bat ├── start_cpu.sh ├── start_gpu.bat └── start_gpu.sh ├── naz-remove-duplicate-images ├── README.md ├── remove_duplicates.py ├── start.bat └── start.sh ├── python-scripts ├── README.md ├── backup_files.bat ├── backup_files.py ├── compare_file_contents.bat ├── compare_file_contents.py ├── create_conda_env.bat ├── create_conda_env.py ├── encrypt_decrypt_files.bat ├── encrypt_decrypt_files.py ├── generate_data_reports.bat ├── generate_data_reports.py ├── manage_user_accounts.bat ├── manage_user_accounts.py ├── merge_csv_files.bat ├── merge_csv_files.py ├── monitor_network_traffic.bat ├── monitor_network_traffic.py ├── monitor_process_memory.bat ├── monitor_process_memory.py ├── monitor_system_resources.bat ├── monitor_system_resources.py ├── organize_files_by_type.bat ├── organize_files_by_type.py ├── password_generator.bat ├── password_generator.py ├── rename_files_in_bulk.bat ├── rename_files_in_bulk.py ├── scan_open_ports.bat └── scan_open_ports.py └── windows-scripts ├── README.md ├── add_miniconda3_to_path.bat ├── block_exe_files_firewall.bat ├── create_system_restore_point.bat ├── find_large_files.bat ├── list_installed_apps_with_winget.bat ├── list_winget_install_commands.bat ├── open_apps_folder.bat ├── restart_explorer.bat ├── toggle_hidden_files.bat └── update_all_apps.bat /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Naztech Software 2 | 3 | Thank you for your interest in contributing to Naztech Software! I appreciate your support and look forward to collaborating with you to improve this project. 4 | 5 | ## How to Contribute 6 | 7 | 1. Fork the repository on GitHub. 8 | 2. Create a new branch with a descriptive name for your feature or bug fix. 9 | 3. Make your modifications and additions. 10 | 4. Test your changes thoroughly. 11 | 5. Commit your changes and push them to your forked repository. 12 | 6. Submit a pull request to the main repository, clearly explaining the changes you have made and their benefits. 13 | 14 | ## Guidelines 15 | 16 | To ensure a smooth contribution process, please follow these guidelines: 17 | 18 | - Ensure that your code follows the project's coding style and conventions. 19 | - Write clear and concise commit messages and pull request descriptions. 20 | - If your contribution introduces new features or modifies existing ones, please update the relevant documentation accordingly. 21 | - If your contribution fixes a bug, please reference the issue number in your pull request description. 22 | - Be respectful and considerate towards other contributors and maintainers. 23 | 24 | ## Issues and Bug Reports 25 | 26 | If you encounter any issues or bugs while using Naztech Software, please [submit an issue](https://github.com/nazpins/naztech-software/issues) on the GitHub repository. When submitting an issue, please provide detailed information about the problem, including steps to reproduce it and any relevant error messages. 27 | 28 | ## Feature Requests 29 | 30 | If you have ideas for new features or improvements to Naztech Software, feel free to [submit a feature request](https://github.com/nazpins/naztech-software/issues) on the GitHub repository. Please describe the proposed feature in detail and explain how it would benefit the project. 31 | 32 | ## Contact 33 | 34 | If you have any questions or need further assistance, you can reach out to me through the [GitHub repository](https://github.com/nazpins/naztech-software). 35 | 36 | Thank you for your contributions and support! 37 | 38 | --- -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 nazpins 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Naztech Automated Data Sorting Tools 2 | 3 | [![Windows](https://img.shields.io/badge/Windows-green.svg)](https://opensource.org/licenses/MIT) 4 | [![Linux](https://img.shields.io/badge/Linux-blue.svg)](https://opensource.org/licenses/MIT) 5 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 6 | 7 | **Naztech Automated Data Sorting Tools** (Naztech ADST) offers a suite of powerful utilities designed to streamline and enhance the organization of files and data. From advanced AI-driven file sorting, to duplicate algorithmic hash detection image removal, to simple folder sorting scripts, Naztech ADST provides automated tools tailored for any type of workflow. My utility scripts for Windows are also included. 8 | 9 | ## Table of Contents 10 | 11 | - [Projects](#projects) 12 | - [Precision-Classification-Sorter](#precision-classification-sorter) 13 | - [File-Sorter & File-Sorter-Lite](#file-sorter--file-sorter-lite) 14 | - [Remove-Duplicate-Images](#remove-duplicate-images) 15 | - [Doc-Sorter](#doc-sorter) 16 | - [Python Scripts](#python-scripts) 17 | - [Windows Scripts](#windows-scripts) 18 | - [Getting Started](#getting-started) 19 | - [Prerequisites](#prerequisites) 20 | - [Installation](#installation) 21 | - [Usage](#usage) 22 | - [Contributing](#contributing) 23 | - [License](#license) 24 | - [Contact](#contact) 25 | 26 | ## Projects 27 | 28 | ### [Precision-Classification-Sorter](#precision-classification-sorter) 29 | An advanced AI-powered tool that efficiently categorizes data. It employs machine learning models to intelligently sort text and images into relevant categories, optimizing data management processes. 30 | 31 | ### [File-Sorter & File-Sorter-Lite](#file-sorter--file-sorter-lite) 32 | Designed for straightforward file organization, these tools automatically sort files into predefined directories based on their file types, quick and easy. 33 | 34 | ### [Remove-Duplicate-Images](#remove-duplicate-images) 35 | Utilizes advanced hash algorithms to identify and eliminate duplicate images, freeing up storage and simplifying your photo libraries. 36 | 37 | ### [Doc-Sorter](#doc-sorter) 38 | Streamlines the management of documents by using metadata from the Google Books API to organize ebooks and PDFs into author-specific directories. 39 | 40 | ### [Python Scripts](#python-scripts) 41 | A collection of versatile scripts for automation, data processing, and machine learning tasks, harnessing Python's capabilities to solve various challenges. 42 | 43 | ### [Windows Scripts](#windows-scripts) 44 | A series of scripts designed for Windows users focusing on automation, data sorting, and system enhancements to boost productivity and security. 45 | 46 | ## Getting Started 47 | 48 | ### Prerequisites 49 | 50 | - Python 3.x 51 | - Conda package manager (optional but recommended for managing Python environments) 52 | 53 | ### Installation 54 | 55 | ```bash 56 | git clone https://github.com/nazpins/naztech-automated-data-sorting-tools.git 57 | cd naztech-automated-data-sorting-tools 58 | ``` 59 | 60 | Follow the installation instructions in each project's README for detailed setup guidance. 61 | 62 | ## Usage 63 | 64 | Refer to each project's specific README for detailed instructions on how to use the tools effectively. 65 | 66 | ## Contributing 67 | 68 | Contributions are welcome! If you have suggestions or improvements, please: 69 | 70 | 1. Fork the repository. 71 | 2. Create a new branch for your feature. 72 | 3. Make your changes and test them. 73 | 4. Submit a pull request detailing your changes. 74 | 75 | ## Warning 76 | 77 | Use caution: these tools will modify and organize files in specified directories. It is recommended to back up your data before using them to avoid unintended data loss. 78 | 79 | ## License 80 | 81 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 82 | 83 | ## Contact 84 | 85 | For questions or feedback, please contact the project maintainer through the [GitHub repository](https://github.com/nazpins/naztech-automated-data-sorting-tools). 86 | 87 | --- -------------------------------------------------------------------------------- /ai_cleanup-program/README.md: -------------------------------------------------------------------------------- 1 | # AI Maintenance Utility 2 | 3 | ## Installation 4 | Ensure Python 3.8+ is installed. Install required packages with: 5 | -------------------------------------------------------------------------------- /ai_cleanup-program/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "nlp_model": "facebook/bart-large-mnli", 3 | "temp_folders": ["C:\\Windows\\Temp", "C:\\Users\\USERNAME\\AppData\\Local\\Temp"], 4 | "log_settings": { 5 | "file": "maintenance_log.log", 6 | "level": "INFO", 7 | "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ai_cleanup-program/main.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from ui import MaintenanceUtilityUI 3 | from nlp import process_user_input 4 | from maintenance import organize_files_by_type, find_duplicates, disk_cleanup, registry_cleanup, optimize_startup, defragment_disk 5 | 6 | logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filename='maintenance_log.log', filemode='a') 7 | 8 | def execute_command(command, path): 9 | if command == 'organize files': 10 | organize_files_by_type(path) 11 | elif command == 'remove duplicates': 12 | find_duplicates(path) # Assume this handles the deletion 13 | elif command == 'disk cleanup': 14 | disk_cleanup([path], recycle_bin=True) 15 | elif command == 'registry cleanup': 16 | registry_cleanup() 17 | elif command == 'optimize startup': 18 | optimize_startup() 19 | elif command == 'defragment disk': 20 | defragment_disk() 21 | else: 22 | logging.error(f"Unknown command: {command}") 23 | 24 | def handle_user_input(user_input): 25 | command, path = process_user_input(user_input) 26 | execute_command(command, path) 27 | 28 | if __name__ == '__main__': 29 | ui = MaintenanceUtilityUI(handle_user_input) 30 | ui.run() 31 | -------------------------------------------------------------------------------- /ai_cleanup-program/maintenance.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import logging 4 | from winreg import ConnectRegistry, OpenKey, HKEY_LOCAL_MACHINE, EnumValue, DeleteValue 5 | 6 | logger = logging.getLogger(__name__) 7 | 8 | def organize_files_by_type(path): 9 | """Organize files in the specified directory by their extension types.""" 10 | try: 11 | for item in os.listdir(path): 12 | full_item_path = os.path.join(path, item) 13 | if os.path.isfile(full_item_path): 14 | file_ext = item.split('.')[-1] 15 | new_dir = os.path.join(path, file_ext) 16 | if not os.path.exists(new_dir): 17 | os.makedirs(new_dir) 18 | shutil.move(full_item_path, os.path.join(new_dir, item)) 19 | logger.info(f"Files in {path} organized by file type.") 20 | except Exception as e: 21 | logger.error(f"Failed to organize files in {path}: {str(e)}") 22 | 23 | def find_duplicates(path): 24 | """Find duplicate files in the specified directory.""" 25 | files_seen = {} 26 | duplicates = [] 27 | for dirpath, _, filenames in os.walk(path): 28 | for filename in filenames: 29 | filepath = os.path.join(dirpath, filename) 30 | filehash = hash(open(filepath, 'rb').read()) 31 | if filehash in files_seen: 32 | duplicates.append((filepath, files_seen[filehash])) 33 | else: 34 | files_seen[filehash] = filepath 35 | logger.info(f"Found duplicates in {path}.") 36 | return duplicates 37 | 38 | def disk_cleanup(paths, recycle_bin=True): 39 | """Simulate disk cleanup by deleting temporary files and optionally emptying the recycle bin.""" 40 | try: 41 | for path in paths: 42 | shutil.rmtree(path, ignore_errors=True) 43 | if recycle_bin: 44 | # Simulate emptying the recycle bin 45 | logger.info("Recycle bin emptied.") 46 | logger.info("Disk cleanup completed.") 47 | except Exception as e: 48 | logger.error(f"Error during disk cleanup: {str(e)}") 49 | 50 | def registry_cleanup(): 51 | """Simulate cleaning up the registry by deleting unused keys.""" 52 | try: 53 | reg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) 54 | key = OpenKey(reg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") 55 | for i in range(1024): 56 | try: 57 | asubkey_name = EnumValue(key, i)[0] 58 | if 'MySoftware' in asubkey_name: # Example condition 59 | DeleteValue(key, asubkey_name) 60 | except EnvironmentError: 61 | break 62 | logger.info("Registry cleanup completed.") 63 | except Exception as e: 64 | logger.error(f"Error cleaning registry: {str(e)}") 65 | 66 | def optimize_startup(): 67 | """Simulate startup optimization.""" 68 | logger.info("Startup optimization simulated.") 69 | 70 | def defragment_disk(): 71 | """Simulate disk defragmentation.""" 72 | logger.info("Disk defragmentation simulated.") 73 | 74 | # This code is for illustration purposes and includes simulated responses for actions like cleanup and defragmentation. 75 | -------------------------------------------------------------------------------- /ai_cleanup-program/nlp.py: -------------------------------------------------------------------------------- 1 | from transformers import pipeline 2 | import re 3 | 4 | def preprocess_text(text: str) -> str: 5 | return text.lower() 6 | 7 | def extract_command(text: str): 8 | classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") 9 | commands = ['organize files', 'remove duplicates', 'disk cleanup', 'registry cleanup', 'optimize startup', 'defragment disk'] 10 | result = classifier(text, candidate_labels=commands, multi_label=False) 11 | return result['labels'][0], result['scores'][0] 12 | 13 | def extract_path(text: str): 14 | pattern = r"[C-Z]:\\[^\\:*?\"<>|\r\n]+\\[^\\:*?\"<>|\r\n]*" 15 | match = re.search(pattern, text) 16 | return match.group(0) if match else "No path detected" 17 | 18 | def process_user_input(user_input: str): 19 | text = preprocess_text(user_input) 20 | command, confidence = extract_command(text) 21 | path = extract_path(text) 22 | return command, path 23 | -------------------------------------------------------------------------------- /ai_cleanup-program/start.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Creating a virtual environment... 3 | python -m venv env 4 | 5 | echo Activating the virtual environment... 6 | call env\Scripts\activate 7 | 8 | echo Installing required packages... 9 | pip install transformers nltk 10 | 11 | echo Installing TensorFlow for deep learning capabilities... 12 | pip install tensorflow 13 | 14 | echo Optionally, you can uncomment the next line to install PyTorch instead of or in addition to TensorFlow 15 | REM pip install torch torchvision torchaudio 16 | 17 | echo Running the AI Maintenance Utility... 18 | python main.py 19 | 20 | echo. 21 | echo AI Maintenance Utility has finished running. Press any key to exit. 22 | pause > nul 23 | -------------------------------------------------------------------------------- /ai_cleanup-program/ui.py: -------------------------------------------------------------------------------- 1 | class MaintenanceUtilityUI: 2 | def __init__(self, handle_user_input): 3 | self.handle_user_input = handle_user_input 4 | 5 | def run(self): 6 | print("Welcome to the AI Maintenance Utility. Type 'exit' to quit.") 7 | while True: 8 | user_input = input("> ") 9 | if user_input.lower() == 'exit': 10 | break 11 | command, path = self.handle_user_input(user_input) 12 | print(f"Command: {command}, Path: {path}") 13 | -------------------------------------------------------------------------------- /naz-doc-sorter/README.md: -------------------------------------------------------------------------------- 1 | # Naztech Doc Sorter 2 | 3 | Naztech Doc Sorter is a program that organizes your documents by renaming them according to metadata fetched from the Google Books API and sorting them into folders named after the authors. 4 | 5 | ## Features 6 | 7 | - Renames documents based on metadata from the Google Books API 8 | - Organizes documents into folders named after the authors 9 | - Provides a user-friendly interface with prompts for setup and usage 10 | 11 | ## Setup 12 | 13 | 1. Make sure you have Python installed on your system. 14 | 2. Clone this repository or download the scripts. 15 | 3. Run `start.sh` (Linux/Mac) or `start.bat` (Windows) to set up the environment and start the script. 16 | 17 | ## Usage 18 | 19 | 1. Run the `start` script corresponding to your operating system. 20 | 2. Enter your Google Books API key when prompted. 21 | 3. Enter the full path to the directory containing the documents to sort. 22 | 4. Choose whether to include the datetime in the filenames. 23 | 5. The script will process the files and organize them into author-specific folders. 24 | 25 | ## Dependencies 26 | 27 | - requests 28 | 29 | ## Warning 30 | 31 | Please note that the script modifies the structure of the directory you specify by organizing files into folders. It is highly recommended to back up your data before running the script to avoid any unintended loss or modification of files. 32 | 33 | ## License 34 | 35 | This project is licensed under the [MIT License](LICENSE). 36 | 37 | ## Author 38 | 39 | Naztech Doc Sorter is developed by nazpins (https://github.com/nazpins). 40 | 41 | Feel free to contribute to the project by submitting pull requests or reporting issues on the [GitHub repository](https://github.com/nazpins/naztech-software/tree/main/naz-doc-sorter). -------------------------------------------------------------------------------- /naz-doc-sorter/sort_docs.py: -------------------------------------------------------------------------------- 1 | import os 2 | import webbrowser 3 | import requests 4 | import logging 5 | from datetime import datetime 6 | 7 | # Set up logging 8 | logging.basicConfig(filename='doc_sorter.log', level=logging.INFO, 9 | format='%(asctime)s - %(levelname)s - %(message)s') 10 | 11 | def sanitize_filename(name): 12 | """Sanitize the file name by replacing invalid characters.""" 13 | invalid_chars = '<>:"/\\|?*' 14 | for ch in invalid_chars: 15 | name = name.replace(ch, '_') 16 | return name 17 | 18 | def fetch_metadata(query, api_key): 19 | """Fetch metadata from the Google Books API.""" 20 | base_url = "https://www.googleapis.com/books/v1/volumes" 21 | params = {'q': query, 'key': api_key} 22 | response = requests.get(base_url, params=params) 23 | logging.info(f'Searching for: {query}') 24 | if response.status_code != 200: 25 | logging.error(f'Error fetching metadata: {response.status_code}') 26 | logging.error(f'Response content: {response.text}') 27 | return query, 'Unknown Author' 28 | data = response.json() 29 | logging.info(f'Response Data: {data}') 30 | if data['totalItems'] > 0: 31 | book = data['items'][0]['volumeInfo'] 32 | title = book.get('title', 'Unknown Title') 33 | authors = book.get('authors', ['Unknown Author']) 34 | logging.info(f'Found Title: {title}, Author: {authors[0]}') 35 | return title, authors[0] 36 | logging.warning(f'No results found for query: {query}') 37 | return query, 'Unknown Author' 38 | 39 | def rename_and_sort_files(directory, sorted_path, include_datetime, api_key): 40 | """Rename and move files based on fetched metadata.""" 41 | for root, dirs, files in os.walk(directory, topdown=False): 42 | for file in files: 43 | file_path = os.path.join(root, file) 44 | if 'SortedFiles' not in root: 45 | original_name, extension = os.path.splitext(file) 46 | title, author = fetch_metadata(original_name, api_key) 47 | safe_title = sanitize_filename(title) 48 | safe_author = sanitize_filename(author) 49 | new_name = f"{safe_author} - {safe_title}{extension}" 50 | new_file_path = os.path.join(root, new_name) 51 | author_dir = os.path.join(sorted_path, safe_author) 52 | if not os.path.exists(author_dir): 53 | os.makedirs(author_dir) 54 | final_path = os.path.join(author_dir, new_name) 55 | try: 56 | os.rename(file_path, final_path) 57 | except OSError as e: 58 | logging.error(f'Failed to rename or move file {file_path} to {final_path}: {e}') 59 | 60 | def main(): 61 | """Main function to execute the script functionalities.""" 62 | print("\033c", end="") # Clear screen 63 | print("\033[1;34mNAZTECH DOC SORTER STARTED...\033[0m") 64 | print("\033[1;31;47mWARNING: BACK UP YOUR DATA FIRST\033[0m") 65 | print("\033[1;33m" + "="*80 + "\033[0m") 66 | print("\033[1;33mThis script will modify the structure of the directory you specify by organizing files into folders.\033[0m") 67 | print("\033[1;33m" + "="*80 + "\033[0m") 68 | 69 | api_key = input("\033[1;32mPlease enter your Google Books API key: \033[0m").strip() 70 | if not api_key: 71 | print("\033[1;31mAPI Key is required to fetch metadata from Google Books API.\033[0m") 72 | return # Exit the script if API key is not provided 73 | include_datetime = input("\033[1;32mDo you want to include datetime in file names? (Y/N): \033[0m").strip().upper() == 'Y' 74 | directory_to_sort = input("\033[1;32mPlease enter the full path to the directory you wish to sort: \033[0m").strip() 75 | sorted_files_path = os.path.join(directory_to_sort, 'SortedFiles') 76 | 77 | rename_and_sort_files(directory_to_sort, sorted_files_path, include_datetime, api_key) 78 | 79 | print("\033[1;36mFiles have been organized. Access your sorted files at: " + sorted_files_path + "\033[0m") 80 | try: 81 | webbrowser.open(f'file://{sorted_files_path}') 82 | print("\033[1;35mOpening the sorted files directory...\033[0m") 83 | except Exception as e: 84 | print(f"\033[1;31mCould not open the folder automatically, please navigate to it manually. Error: {e}\033[0m") 85 | 86 | if __name__ == "__main__": 87 | main() 88 | -------------------------------------------------------------------------------- /naz-doc-sorter/start.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cls 3 | 4 | :: Check for Python and report if not installed 5 | python --version >nul 2>&1 6 | if %errorlevel% neq 0 ( 7 | echo Python is not installed. Please install Python. 8 | pause 9 | exit /b 10 | ) 11 | 12 | :: Set up virtual environment 13 | echo Setting up virtual environment... 14 | python -m venv env 15 | call env\Scripts\activate 16 | 17 | :: Install necessary Python packages 18 | echo Installing required packages... 19 | pip install requests 20 | 21 | :: Run the script 22 | echo Running the script... 23 | python sort_docs.py 24 | pause 25 | -------------------------------------------------------------------------------- /naz-doc-sorter/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | 4 | # Check for Python and report if not installed 5 | if ! command -v python3 &>/dev/null; then 6 | echo "Python 3 is not installed. Please install Python 3." 7 | exit 1 8 | fi 9 | 10 | # Set up virtual environment 11 | echo "Setting up virtual environment..." 12 | python3 -m venv env 13 | source env/bin/activate 14 | 15 | # Install necessary Python packages 16 | echo "Installing required packages..." 17 | pip install requests 18 | 19 | # Run the script 20 | echo "Running the script..." 21 | python3 sort_docs.py 22 | -------------------------------------------------------------------------------- /naz-file-sorter-lite/README.md: -------------------------------------------------------------------------------- 1 | # Naztech File Sorter Lite 2 | 3 | Naztech File Sorter Lite is a program that helps you organize files in a directory by sorting them into folders based on their file extensions. It provides a simple and efficient way to keep your files organized and easily accessible. 4 | 5 | ## Features 6 | 7 | - Automatically sorts files into predefined folders based on their file extensions 8 | - Supports a wide range of file types, including images, documents, audio, videos, applications, and archives 9 | - Moves files with unknown extensions to an 'Other' folder 10 | - Provides a user-friendly interface with clear prompts and messages 11 | - Opens the sorted files directory automatically after the sorting process is complete 12 | 13 | ## Usage 14 | 15 | 1. Make sure you have Python installed on your system. 16 | 2. Download the `organize_files_by_type.py` script. 17 | - You can also use the start.bat file to start the program at this point and skip the steps below. 18 | 3. Open a terminal or command prompt and navigate to the directory where the script is located. 19 | 4. Run the script by executing the following command: python organize_files_by_type.py 20 | 5. When prompted, enter the path to the directory you want to sort. 21 | 6. The script will organize the files in the specified directory into folders based on their file extensions. 22 | 7. Once the sorting process is complete, the script will automatically open the sorted files directory. 23 | 24 | ## Warning 25 | 26 | Please note that the script modifies the structure of the directory you specify by organizing files into folders. It is highly recommended to back up your data before running the script to avoid any unintended loss or modification of files. 27 | 28 | ## Supported File Types 29 | 30 | The script supports the following file types: 31 | 32 | - Images: .jpg, .jpeg, .png, .gif, .bmp 33 | - Documents: .txt, .doc, .docx, .pdf, .xlsx, .csv, .md, .epub, .mobi 34 | - Audio: .mp3, .wav, .flac, .aac 35 | - Videos: .mp4, .avi, .mkv, .mov 36 | - Applications: .exe, .msi 37 | - Archives: .zip, .rar, .7z, .tar, .gz 38 | 39 | Files with extensions not listed above will be moved to the 'Other' folder. 40 | 41 | ## License 42 | 43 | This project is licensed under the [MIT License](LICENSE). 44 | 45 | ## Author 46 | 47 | Naztech File Sorter Lite is developed by nazpins (https://github.com/nazpins). 48 | 49 | Feel free to contribute to the project by submitting pull requests or reporting issues on the [GitHub repository](https://github.com/nazpins/naztech-software/tree/main/naz-file-sorter-lite). -------------------------------------------------------------------------------- /naz-file-sorter-lite/organize_files_by_type.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import webbrowser 4 | 5 | def organize_files_by_type(directory): 6 | # Dictionary to store the mapping of file extensions to folder names 7 | extension_folders = { 8 | '.jpg': 'Images', 9 | '.jpeg': 'Images', 10 | '.png': 'Images', 11 | '.gif': 'Images', 12 | '.bmp': 'Images', 13 | '.txt': 'Documents', 14 | '.doc': 'Documents', 15 | '.docx': 'Documents', 16 | '.pdf': 'Documents', 17 | '.xlsx': 'Documents', 18 | '.csv': 'Documents', 19 | '.md': 'Documents', 20 | '.epub': 'Documents', 21 | '.mobi': 'Documents', 22 | '.mp3': 'Audio', 23 | '.wav': 'Audio', 24 | '.flac': 'Audio', 25 | '.aac': 'Audio', 26 | '.mp4': 'Videos', 27 | '.avi': 'Videos', 28 | '.mkv': 'Videos', 29 | '.mov': 'Videos', 30 | '.exe': 'Applications', 31 | '.msi': 'Applications', 32 | '.zip': 'Archives', 33 | '.rar': 'Archives', 34 | '.7z': 'Archives', 35 | '.tar': 'Archives', 36 | '.gz': 'Archives' 37 | } 38 | 39 | # Iterate over the files in the directory 40 | for filename in os.listdir(directory): 41 | file_path = os.path.join(directory, filename) 42 | 43 | # Check if the item is a file 44 | if os.path.isfile(file_path): 45 | # Get the file extension 46 | _, extension = os.path.splitext(filename) 47 | extension = extension.lower() 48 | 49 | # Check if the file extension exists in the mapping 50 | if extension in extension_folders: 51 | # Get the destination folder name 52 | folder_name = extension_folders[extension] 53 | 54 | # Create the destination folder if it doesn't exist 55 | folder_path = os.path.join(directory, folder_name) 56 | os.makedirs(folder_path, exist_ok=True) 57 | 58 | # Move the file to the destination folder 59 | destination_path = os.path.join(folder_path, filename) 60 | shutil.move(file_path, destination_path) 61 | print(f"Moved {filename} to {folder_name} folder.") 62 | else: 63 | # Create an 'Other' folder for files with unknown extensions 64 | other_folder = os.path.join(directory, 'Other') 65 | os.makedirs(other_folder, exist_ok=True) 66 | 67 | # Move the file to the 'Other' folder 68 | destination_path = os.path.join(other_folder, filename) 69 | shutil.move(file_path, destination_path) 70 | print(f"Moved {filename} to Other folder.") 71 | else: 72 | print(f"{filename} is not a file. Skipping.") 73 | 74 | print("\033[1;32mFile organization completed.\033[0m") 75 | print("\033[1;36mAccess your sorted files at:\033[0m", directory) 76 | 77 | try: 78 | webbrowser.open(f'file://{directory}') 79 | print("\033[1;35mOpening the sorted files directory...\033[0m") 80 | except Exception as e: 81 | print("\033[1;31mCould not open the folder automatically, please navigate to it manually.\033[0m") 82 | 83 | if __name__ == '__main__': 84 | print("\033c", end="") # ANSI escape code to clear the screen 85 | print("\033[1;34mNAZTECH FILE SORTER LITE\033[0m") 86 | print("\033[1;31;47mWARNING: BACK UP YOUR DATA FIRST\033[0m") # Bold, red text on white background 87 | print("\033[1;33m" + "="*80 + "\033[0m") # Yellow bold delimiters 88 | print("\033[1;33mThis script will modify the structure of the directory you specify by organizing files into folders.\033[0m") 89 | print("\033[1;33m" + "="*80 + "\033[0m") # Yellow bold delimiters 90 | 91 | directory = input("\033[1;32mEnter the directory path: \033[0m") 92 | 93 | organize_files_by_type(directory) -------------------------------------------------------------------------------- /naz-file-sorter-lite/start.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Prompt the user for the directory path 4 | set /p directory="Enter the directory path: " 5 | 6 | REM Run the Python script with the provided directory path 7 | python organize_files_by_type.py "%directory%" 8 | 9 | pause -------------------------------------------------------------------------------- /naz-file-sorter-lite/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Prompt the user for the directory path 4 | read -p "Enter the directory path: " directory 5 | 6 | # Run the Python script with the provided directory path 7 | python3 organize_files_by_type.py "$directory" 8 | 9 | read -p "Press Enter to exit..." -------------------------------------------------------------------------------- /naz-file-sorter/README.md: -------------------------------------------------------------------------------- 1 | # Naztech File Sorter 2 | 3 | The Naztech File Sorter is a Python-based utility that helps you organize your files into categorized directories based on their type. It supports custom categorizations such as Documents, Pictures, Videos, and Audio. You can also choose whether to include datetime stamps in the filenames. 4 | 5 | ## Features 6 | 7 | - Categorizes files into Documents, Pictures, Videos, Audio, and Others 8 | - Option to append datetime to filenames for better version management 9 | - Places sorted files within a 'SortedFiles' directory inside the chosen directory 10 | 11 | ## Prerequisites 12 | 13 | Ensure you have Python installed on your machine. This script has been tested with Python 3.8 and above. 14 | 15 | ## Setup 16 | 17 | To set up the script, clone this repository or download the files directly into a directory of your choice. 18 | 19 | ## Installation 20 | 21 | No additional libraries are required to run the script as it uses built-in Python modules. If you encounter any issues, you may need to ensure your Python installation is correct and includes the standard library. 22 | 23 | ## Usage 24 | 25 | ### Windows 26 | 27 | 1. Make sure you have Python installed on your system. 28 | 2. Download the `sort_files.py` script. 29 | - You can also use the start.bat file to start the program at this point and skip the steps below. 30 | 3. Open a command prompt and navigate to the directory where the script is located. 31 | 4. Run the script by executing the following command: 32 | ``` 33 | python sort_files.py 34 | ``` 35 | 5. Follow the prompts to specify the directory you want to sort and whether to include datetime in the filenames. 36 | 37 | ### Linux 38 | 39 | 1. Make sure you have Python installed on your system. 40 | 2. Download the `sort_files.py` script and the `start.sh` file. 41 | 3. Open a terminal and navigate to the directory where the script and shell file are located. 42 | 4. Make the shell file executable by running the following command: 43 | ``` 44 | chmod +x start.sh 45 | ``` 46 | 5. Run the script by executing the following command: 47 | ``` 48 | ./start.sh 49 | ``` 50 | 6. Follow the prompts to specify the directory you want to sort and whether to include datetime in the filenames. 51 | 52 | ## Warning 53 | 54 | Please note that the script modifies the structure of the directory you specify by organizing files into folders. It is highly recommended to back up your data before running the script to avoid any unintended loss or modification of files. 55 | 56 | ## License 57 | 58 | This project is licensed under the [MIT License](LICENSE). 59 | 60 | ## Author 61 | 62 | Naztech Doc Sorter is developed by nazpins (https://github.com/nazpins). 63 | 64 | Feel free to contribute to the project by submitting pull requests or reporting issues on the [GitHub repository](https://github.com/nazpins/naztech-software/blob/main/naz-file-sorter). -------------------------------------------------------------------------------- /naz-file-sorter/sort_files.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import webbrowser 4 | from datetime import datetime 5 | 6 | def fallback_name(original_name, extension, include_datetime): 7 | if include_datetime: 8 | timestamp = datetime.now().strftime("_%Y%m%d%H%M%S") 9 | return f"{original_name}{timestamp}{extension}" 10 | else: 11 | return f"{original_name}{extension}" 12 | 13 | def categorize_and_move(file_path, base_dir): 14 | _, extension = os.path.splitext(file_path) 15 | file_type = extension.lower() 16 | if file_type in ['.docx', '.doc', '.txt', '.pdf']: 17 | category = 'Documents' 18 | elif file_type in ['.jpg', '.jpeg', '.png', '.gif']: 19 | category = 'Pictures' 20 | elif file_type in ['.mp3', '.wav', '.aac']: 21 | category = 'Audio' 22 | elif file_type in ['.mp4', '.avi', '.mov']: 23 | category = 'Videos' 24 | else: 25 | category = 'Others' # Additional category for unmatched types 26 | 27 | target_dir = os.path.join(base_dir, category, file_type.replace('.', '')) 28 | os.makedirs(target_dir, exist_ok=True) 29 | target_file_path = os.path.join(target_dir, os.path.basename(file_path)) 30 | shutil.move(file_path, target_file_path) 31 | 32 | def main(): 33 | print("\033c", end="") # ANSI escape code to clear the screen 34 | print("\033[1;34mNAZTECH FILE SORTER STARTED...\033[0m") 35 | print("\033[1;31;47mWARNING: BACK UP YOUR DATA FIRST\033[0m") # Bold, red text on white background 36 | print("\033[1;33m" + "="*80 + "\033[0m") # Yellow bold delimiters 37 | print("\033[1;33mThis script will modify the structure of the directory you specify by organizing files into folders.\033[0m") 38 | print("\033[1;33m" + "="*80 + "\033[0m") # Yellow bold delimiters 39 | 40 | include_datetime = input("\n\033[1;32mDo you want to include datetime in file names? (Y/N): \033[0m").strip().upper() == 'Y' 41 | directory_to_sort = input("\033[1;32mPlease enter the full path to the directory you wish to sort: \033[0m").strip() 42 | sorted_files_path = os.path.join(directory_to_sort, 'SortedFiles') # 'SortedFiles' within the user-specified directory 43 | 44 | for root, dirs, files in os.walk(directory_to_sort, topdown=False): # Ensure we do not rearrange as we walk 45 | for file in files: 46 | file_path = os.path.join(root, file) 47 | if 'SortedFiles' not in root: # Avoid re-sorting already sorted files 48 | original_name, extension = os.path.splitext(file) 49 | new_name = fallback_name(original_name, extension, include_datetime) 50 | new_file_path = os.path.join(root, new_name) 51 | os.rename(file_path, new_file_path) 52 | categorize_and_move(new_file_path, sorted_files_path) 53 | 54 | print("\033[1;36mFiles have been organized. Access your sorted files at: " + sorted_files_path + "\033[0m") 55 | try: 56 | webbrowser.open(f'file://{sorted_files_path}') # Opens the folder in the file explorer 57 | print("\033[1;35mOpening the sorted files directory...\033[0m") 58 | except Exception as e: 59 | print("\033[1;31mCould not open the folder automatically, please navigate to it manually.\033[0m") 60 | 61 | if __name__ == "__main__": 62 | main() 63 | -------------------------------------------------------------------------------- /naz-file-sorter/start.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Setting up the environment... 3 | python -m venv env 4 | call env\Scripts\activate 5 | pip install requests 6 | echo Environment setup complete. 7 | echo Running sort_files.py... 8 | python sort_files.py 9 | echo sort_files.py has finished running. 10 | pause 11 | -------------------------------------------------------------------------------- /naz-file-sorter/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Check if Python is installed 3 | if ! command -v python3 &> /dev/null 4 | then 5 | echo "Python could not be found. Please install Python 3." 6 | exit 7 | fi 8 | 9 | # Run the sorter script 10 | echo "Running naz-file-sorter..." 11 | python3 sort_files.py 12 | -------------------------------------------------------------------------------- /naz-precision-classification-sorter/README.md: -------------------------------------------------------------------------------- 1 | # Precision-Classification-Sorter 2 | 3 | Precision-Classification-Sorter is an advanced file sorting tool powered by AI. It leverages TensorFlow to classify and sort large volumes of data efficiently. The tool supports both CPU and GPU environments. 4 | 5 | ## Prerequisites 6 | 7 | Before you begin, ensure your system meets these requirements: 8 | - Windows 10 or higher 9 | - An NVIDIA GPU (if you want TensorFlow with GPU support) 10 | - [Miniconda](https://docs.conda.io/en/latest/miniconda.html) (recommended for managing environments) 11 | 12 | ## Installation 13 | 14 | ### Installing Miniconda 15 | 16 | 1. Download the Miniconda installer for Windows from [Miniconda's site](https://docs.conda.io/en/latest/miniconda.html). 17 | 2. Run the installer and follow the on-screen instructions. Make sure to select "Add Miniconda to my PATH environment variable" for an easier command-line experience. 18 | 3. Restart your command prompt to ensure Miniconda is recognized. 19 | 20 | ### Setting up TensorFlow Environment 21 | 22 | #### TensorFlow CPU Environment 23 | 24 | 1. **Create and activate the Conda environment for CPU:** 25 | ```bash 26 | conda create --name tf_cpu python=3.9 27 | conda activate tf_cpu 28 | ``` 29 | 2. **Install TensorFlow for CPU:** 30 | ```bash 31 | pip install tensorflow 32 | ``` 33 | 34 | #### TensorFlow GPU Environment 35 | 36 | 1. **Create and activate the Conda environment for GPU:** 37 | ```bash 38 | conda create --name tf_gpu python=3.9 39 | conda activate tf_gpu 40 | ``` 41 | 42 | 2. **Install CUDA and cuDNN:** 43 | ```bash 44 | conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0 45 | ``` 46 | 47 | 3. **Install TensorFlow for GPU:** 48 | ```bash 49 | pip install "tensorflow<2.11" 50 | ``` 51 | 52 | 4. **Verify the GPU setup:** 53 | ```bash 54 | python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))" 55 | ``` 56 | 57 | ## Running the Tool 58 | 59 | Navigate to the project directory in your command prompt and run the following: 60 | 61 | For CPU: 62 | ```bash 63 | conda activate tf_cpu 64 | python sort-with-precision.py 65 | ``` 66 | 67 | For GPU: 68 | ```bash 69 | conda activate tf_gpu 70 | python sort-with-precision.py 71 | ``` 72 | 73 | ## How to Make & Customize Start Scripts 74 | 75 | ### Windows Start Scripts 76 | 77 | #### For TensorFlow CPU (`start_cpu.bat`): 78 | ```batch 79 | @echo off 80 | echo Checking and setting up the environment for CPU... 81 | CALL conda activate tf_cpu 82 | 83 | echo Launching Sort with Precision on CPU... 84 | python sort-with-precision.py 85 | pause 86 | ``` 87 | 88 | #### For TensorFlow GPU (`start_gpu.bat`): 89 | ```batch 90 | @echo off 91 | echo Checking and setting up the environment for GPU... 92 | CALL conda activate tf_gpu 93 | 94 | echo Launching Sort with Precision on GPU... 95 | python sort-with-precision.py 96 | pause 97 | ``` 98 | 99 | ### Unix-like Systems Start Scripts 100 | 101 | #### For TensorFlow CPU (`start_cpu.sh`): 102 | ```bash 103 | #!/bin/bash 104 | 105 | echo "Checking and setting up the environment for CPU..." 106 | source ~/miniconda3/bin/activate tf_cpu 107 | 108 | echo "Launching Sort with Precision on CPU..." 109 | python sort-with-precision.py 110 | ``` 111 | 112 | #### For TensorFlow GPU (`start_gpu.sh`): 113 | ```bash 114 | #!/bin/bash 115 | 116 | echo "Checking and setting up the environment for GPU..." 117 | source ~/miniconda3/bin/activate tf_gpu 118 | 119 | echo "Launching Sort with Precision on GPU..." 120 | python sort-with-precision.py 121 | ``` 122 | 123 | ### How to Use These Scripts 124 | 125 | 1. **Windows Users:** 126 | - Place the appropriate `.bat` file in the same directory as your Python script. 127 | - Double-click `start_cpu.bat` for CPU or `start_gpu.bat` for GPU to run the application. 128 | 129 | 2. **Unix-like System Users:** 130 | - Place the appropriate `.sh` file in the same directory as your Python script. 131 | - Make the script executable by running `chmod +x start_cpu.sh` or `chmod +x start_gpu.sh`. 132 | - Execute the script via the terminal by typing `./start_cpu.sh` for CPU or `./start_gpu.sh` for GPU. 133 | 134 | ### Notes 135 | - Ensure that Miniconda paths are correct in the scripts. Modify the path to `activate` if your Miniconda installation differs from the default. 136 | - Remember to activate the right environment before running the scripts to ensure that all dependencies are correctly loaded. 137 | - It's advisable to test these scripts after setting them up to make sure everything works as expected. 138 | 139 | ## Customization 140 | 141 | You can customize the sorting categories and TensorFlow models used by modifying the `sort-with-precision.py 142 | 143 | ` script. 144 | 145 | ## Troubleshooting 146 | 147 | If you encounter issues with TensorFlow not recognizing your GPU, ensure that your CUDA and cuDNN installations are compatible with the TensorFlow version installed. Additionally, check that your GPU drivers are up to date. 148 | 149 | ## License 150 | 151 | This project is licensed under the MIT License - see the LICENSE file for details. -------------------------------------------------------------------------------- /naz-precision-classification-sorter/sort-with-precision.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import logging 4 | import concurrent.futures 5 | from transformers import pipeline 6 | import tensorflow as tf 7 | from tensorflow.keras.applications.resnet50 import ResNet50, preprocess_input, decode_predictions 8 | from tensorflow.keras.preprocessing import image 9 | import numpy as np 10 | import transformers 11 | 12 | # Suppress model conversion warnings 13 | transformers.logging.set_verbosity_error() 14 | logging.getLogger("transformers.modeling_tf_utils").setLevel(logging.ERROR) 15 | 16 | # Ensure TensorFlow uses GPU 17 | gpus = tf.config.list_physical_devices('GPU') 18 | if gpus: 19 | try: 20 | # Currently, memory growth needs to be the same across GPUs 21 | for gpu in gpus: 22 | tf.config.experimental.set_memory_growth(gpu, True) 23 | except RuntimeError as e: 24 | print("Exception during GPU setup: ", e) 25 | 26 | # Suppress TensorFlow warnings 27 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Suppresses most TensorFlow logs, except critical ones 28 | tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) # Suppress deprecated function warnings 29 | 30 | # Initialize classifiers 31 | text_classifier = pipeline('zero-shot-classification', model='facebook/bart-large-mnli') 32 | image_model = ResNet50(weights='imagenet') 33 | 34 | # Setup logging 35 | logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') 36 | 37 | def classify_text(text): 38 | categories = [ 39 | 'Note', 'Guide', 'Report', 'Documentation', 'Manual', 40 | 'Plan', 'Report', 'Email', 'Database', 'Code' 41 | ] 42 | prediction = text_classifier(text, candidate_labels=categories, multi_label=False) 43 | return prediction['labels'][0] 44 | 45 | def classify_image(image_path): 46 | img = image.load_img(image_path, target_size=(224, 224)) 47 | x = image.img_to_array(img) 48 | x = np.expand_dims(x, axis=0) 49 | x = preprocess_input(x) 50 | preds = image_model.predict(x) 51 | return decode_predictions(preds, top=1)[0][0][1] 52 | 53 | def process_file(file_path, directory): 54 | filename = os.path.basename(file_path) 55 | _, extension = os.path.splitext(filename) 56 | extension = extension.lower() 57 | extension_folders = { 58 | '.txt': 'Text Files', 59 | '.doc': 'Word Documents', 60 | '.docx': 'Word Documents', 61 | '.pdf': 'PDF Files', 62 | '.md': 'Markdown Files', 63 | '.jpg': 'JPEG Images', 64 | '.jpeg': 'JPEG Images', 65 | '.png': 'PNG Images', 66 | '.gif': 'GIF Images', 67 | '.bmp': 'BMP Images', 68 | '.xlsx': 'Excel Files', 69 | '.csv': 'CSV Files', 70 | '.ppt': 'PowerPoint Presentations', 71 | '.pptx': 'PowerPoint Presentations', 72 | '.zip': 'Compressed Archives', 73 | '.rar': 'Compressed Archives', 74 | '.7z': 'Compressed Archives', 75 | '.tar': 'Compressed Archives', 76 | '.gz': 'Compressed Archives', 77 | '.mp3': 'Audio Files', 78 | '.wav': 'Audio Files', 79 | '.mp4': 'Video Files', 80 | '.avi': 'Video Files', 81 | '.mov': 'Video Files', 82 | '.mkv': 'Video Files', 83 | '.py': 'Python Scripts', 84 | '.js': 'JavaScript Files', 85 | '.html': 'HTML Files', 86 | '.css': 'CSS Files', 87 | '.json': 'JSON Files', 88 | '.xml': 'XML Files' 89 | } 90 | 91 | if extension in ['.txt', '.doc', '.docx', '.pdf', '.md']: 92 | try: 93 | with open(file_path, 'r', encoding='utf-8') as file: 94 | content = file.read(5000) 95 | folder_name = classify_text(content) 96 | except Exception as e: 97 | logging.error(f"Error reading {filename}: {str(e)}") 98 | folder_name = 'Unclassified' 99 | elif extension in ['.jpg', '.jpeg', '.png', '.gif', '.bmp']: 100 | folder_name = classify_image(file_path) 101 | else: 102 | folder_name = extension_folders.get(extension, 'Other') 103 | 104 | sorted_output_folder = os.path.join(directory, "Sorted_Output") 105 | folder_path = os.path.join(sorted_output_folder, folder_name) 106 | os.makedirs(folder_path, exist_ok=True) 107 | destination_path = os.path.join(folder_path, filename) 108 | try: 109 | shutil.move(file_path, destination_path) 110 | logging.info(f"Moved {filename} to {folder_name} folder.") 111 | except Exception as e: 112 | logging.error(f"Error moving {filename}: {str(e)}") 113 | 114 | def organize_files_by_type(directory): 115 | with concurrent.futures.ThreadPoolExecutor() as executor: 116 | futures = [] 117 | for root, dirs, files in os.walk(directory): 118 | for filename in files: 119 | file_path = os.path.join(root, filename) 120 | futures.append(executor.submit(process_file, file_path, directory)) 121 | 122 | concurrent.futures.wait(futures) 123 | 124 | # Delete empty folders 125 | for root, dirs, files in os.walk(directory, topdown=False): 126 | for dir in dirs: 127 | dir_path = os.path.join(root, dir) 128 | if not os.listdir(dir_path): 129 | os.rmdir(dir_path) 130 | logging.info(f"Removed empty folder: {dir_path}") 131 | 132 | if __name__ == '__main__': 133 | print("\033[1;34mSORT WITH PRECISION - Powered by AI\033[0m") 134 | print("Enter the directory path to organize files (e.g., C:\\path\\to\\directory):") 135 | directory = input() 136 | try: 137 | organize_files_by_type(directory) 138 | print("\033[1;32mFile organization completed successfully!\033[0m") 139 | except Exception as e: 140 | print(f"\033[1;31mAn error occurred during file organization: {str(e)}\033[0m") -------------------------------------------------------------------------------- /naz-precision-classification-sorter/start_cpu.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Checking and setting up the environment for CPU... 3 | CALL conda activate tf_cpu 4 | 5 | echo Launching Sort with Precision on CPU... 6 | python sort-with-precision.py 7 | pause -------------------------------------------------------------------------------- /naz-precision-classification-sorter/start_cpu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Checking and setting up the environment for CPU..." 4 | source ~/miniconda3/bin/activate tf_cpu 5 | 6 | echo "Launching Sort with Precision on CPU..." 7 | python sort-with-precision.py -------------------------------------------------------------------------------- /naz-precision-classification-sorter/start_gpu.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Checking and setting up the environment for GPU... 3 | CALL conda activate tf_gpu 4 | 5 | echo Launching Sort with Precision on GPU... 6 | python sort-with-precision.py 7 | pause -------------------------------------------------------------------------------- /naz-precision-classification-sorter/start_gpu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Checking and setting up the environment for GPU..." 4 | source ~/miniconda3/bin/activate tf_gpu 5 | 6 | echo "Launching Sort with Precision on GPU..." 7 | python sort-with-precision.py -------------------------------------------------------------------------------- /naz-remove-duplicate-images/README.md: -------------------------------------------------------------------------------- 1 | # Naztech Remove Duplicate Images 2 | 3 | Naztech Remove Duplicate Images is a utility to identify and remove duplicate images in a specified directory. It uses hashing algorithms provided by the `imagehash` library to detect duplicates effectively. 4 | 5 | ## Features 6 | 7 | - Identifies duplicate images using hashing algorithms. 8 | - Removes duplicate images from a specified directory. 9 | - Provides batch, PowerShell, and Unix shell scripts for easy execution. 10 | - Logs the duplicates found and removed in a text file. 11 | 12 | ## Installation 13 | 14 | ### Prerequisites 15 | 16 | - Python 3.x 17 | - PIL (Pillow) 18 | - imagehash 19 | 20 | ### Setup 21 | 22 | 1. Clone this repository to your local machine: 23 | ```bash 24 | git clone https://github.com/nazpins/naztech-software/tree/main/naz-remove-duplicate-images 25 | cd naz-remove-duplicate-images 26 | ``` 27 | 28 | 2. Install the necessary Python libraries: 29 | ```bash 30 | pip install Pillow imagehash 31 | ``` 32 | 33 | ## Usage 34 | 35 | ### Scripts 36 | 37 | 1. Download the appropriate script for your operating system: 38 | - `start.bat` for Windows Batch 39 | - `start.sh` for Unix-like systems 40 | 2. Depending on your OS, double-click the script file or run it in a terminal. 41 | 3. Enter the path to the folder containing the images when prompted. 42 | 4. The script will handle the rest, logging the duplicates found and removed in `duplicate_log.txt`. 43 | 44 | ### Python Script 45 | 46 | 1. Make sure you have Python installed on your system. 47 | 2. Download the `remove_duplicates.py` script. 48 | - You can also double-click the start.bat file to start the program at this point and skip the steps below. 49 | 3. Open a terminal or command prompt and navigate to the directory where the script is located. 50 | 4. Run the script by executing the following command: 51 | ```bash 52 | python remove_duplicates.py 53 | ``` 54 | 5. The script will identify and remove duplicate images, logging the results in `duplicate_log.txt`. 55 | 56 | ## Warning 57 | 58 | Please note that the script modifies the structure of the directory you specify by organizing files into folders. It is highly recommended to back up your data before running the script to avoid any unintended loss or modification of files. 59 | 60 | ## License 61 | 62 | This project is licensed under the [MIT License](LICENSE). 63 | 64 | ## Author 65 | 66 | Naztech Remove Duplicate Images is developed by nazpins (https://github.com/nazpins). 67 | 68 | Feel free to contribute to the project by submitting pull requests or reporting issues on the [GitHub repository](https://github.com/nazpins/naztech-software/tree/main/naz-remove-duplicate-images). 69 | -------------------------------------------------------------------------------- /naz-remove-duplicate-images/remove_duplicates.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | import sys 4 | from PIL import Image 5 | import imagehash 6 | 7 | def find_duplicates(folder_path): 8 | hashes = {} 9 | duplicates = [] 10 | for filename in os.listdir(folder_path): 11 | if filename.endswith(('png', 'jpg', 'jpeg', 'gif', 'bmp')): 12 | file_path = os.path.join(folder_path, filename) 13 | try: 14 | with Image.open(file_path) as img: 15 | hash = imagehash.average_hash(img) 16 | if hash in hashes: 17 | duplicates.append((filename, hashes[hash])) 18 | else: 19 | hashes[hash] = filename 20 | except Exception as e: 21 | print(f"Error processing {filename}: {e}") 22 | return duplicates 23 | 24 | folder_path = sys.argv[1] 25 | try: 26 | duplicate_images = find_duplicates(folder_path) 27 | with open('duplicate_log.txt', 'w') as log: 28 | log.write(f"Total files checked: {len(os.listdir(folder_path))}\n") 29 | log.write(f"Total duplicates found: {len(duplicate_images)}\n") 30 | for dup in duplicate_images: 31 | log.write(f"Duplicate found: {dup[0]} and {dup[1]}\n") 32 | try: 33 | os.remove(os.path.join(folder_path, dup[0])) 34 | log.write(f"Removed: {dup[0]}\n") 35 | except Exception as e: 36 | log.write(f"Failed to remove {dup[0]}: {e}\n") 37 | except Exception as e: 38 | print(f"Failed to process directory {folder_path}: {e}") 39 | 40 | print(f'Results have been logged in duplicate_log.txt in the {folder_path} directory.') 41 | -------------------------------------------------------------------------------- /naz-remove-duplicate-images/start.bat: -------------------------------------------------------------------------------- 1 | 2 | @echo off 3 | echo Enter the path of the folder with duplicate images: 4 | set /p folder_path= 5 | 6 | echo Creating Python Virtual Environment... 7 | python -m venv venv 8 | call venv\Scripts\activate 9 | 10 | echo Installing necessary libraries... 11 | pip install Pillow imagehash 12 | 13 | echo Running duplicate removal script... 14 | python remove_duplicates.py "%folder_path%" 15 | 16 | if exist venv call venv\Scripts\deactivate 17 | echo Results have been logged in 'duplicate_log.txt'. 18 | echo Done. 19 | pause 20 | -------------------------------------------------------------------------------- /naz-remove-duplicate-images/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Enter the path of the folder with duplicate images:" 4 | read folder_path 5 | 6 | echo "Creating Python Virtual Environment..." 7 | python -m venv venv 8 | source venv/bin/activate 9 | 10 | echo "Installing necessary libraries..." 11 | pip install Pillow imagehash 12 | 13 | echo "Running duplicate removal script..." 14 | python remove_duplicates.py "$folder_path" 15 | 16 | if [ -d venv ]; then 17 | deactivate 18 | fi 19 | 20 | echo "Results have been logged in 'duplicate_log.txt'." 21 | echo "Done." 22 | read -p "Press enter to continue..." 23 | -------------------------------------------------------------------------------- /python-scripts/README.md: -------------------------------------------------------------------------------- 1 | # Python-Scripts 2 | 3 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 4 | [![Python Version](https://img.shields.io/badge/python-3.x-blue)](https://www.python.org/downloads/) 5 | 6 | A curated collection of Python scripts designed to streamline workflows, improve productivity, and automate repetitive tasks. This repository covers a wide range of areas, including machine learning, automation, data sorting, security, and management. 7 | 8 | **Warning**: Please review each script before running it. Most of these scripts are automated and will ask for user input, but it's good practice to understand what a script does before executing it. 9 | 10 | ## Table of Contents 11 | 12 | - [Prerequisites](#prerequisites) 13 | - [Installation](#installation) 14 | - [Scripts](#scripts) 15 | - [Usage](#usage) 16 | - [Customization](#customization) 17 | - [Contributing](#contributing) 18 | - [License](#license) 19 | - [Disclaimer](#disclaimer) 20 | 21 | ## Prerequisites 22 | 23 | Before running the scripts, ensure that you have the following prerequisites installed: 24 | 25 | - Python 3.x 26 | - Conda package manager (optional but recommended) 27 | 28 | ## Installation 29 | 30 | 1. Clone the repository: 31 | 32 | ```bash 33 | git clone https://github.com/nazpins/naztech-software/edit/main/python-scripts.git 34 | ``` 35 | 2. You're ready to use the scripts! Double-click the `.bat` file and follow the prompts to provide the necessary inputs. 36 | 37 | ## Scripts 38 | 39 | 1. `backup_files.py`: Automate the backup of important files and directories to a local or remote location, with options for compression and encryption. 40 | 41 | 2. `compare_file_contents.py`: Compare the contents of two files or directories, highlighting differences and similarities. 42 | 43 | 3. `create_conda_env.py`: Create a new Conda environment for a machine learning project, installing common libraries like NumPy, Pandas, and scikit-learn. 44 | 45 | 4. `encrypt_decrypt_files.py`: Encrypt and decrypt files using symmetric or asymmetric encryption algorithms. 46 | 47 | 5. `generate_data_reports.py`: Generate data reports from various data sources (e.g., databases, APIs), with options for customizing the report format and content. 48 | 49 | 6. `manage_user_accounts.py`: Manage user accounts, including creating, modifying, and deleting user profiles. 50 | 51 | 7. `merge_csv_files.py`: Merge multiple CSV files into a single file, with options for handling headers and data types. 52 | 53 | 8. `monitor_network_traffic.py`: Monitor network traffic, including incoming and outgoing connections, with options for filtering and logging. 54 | 55 | 9. `monitor_process_memory.py`: Monitor the memory usage of specific processes, with options for logging and alerting when thresholds are exceeded. 56 | 57 | 10. `monitor_system_resources.py`: Monitor system resources like CPU usage, memory consumption, and disk space, with options for logging and alerting. 58 | 59 | 11. `organize_files_by_type.py`: Organize files in a directory by their file types (e.g., images, documents, videos), creating subdirectories for each type. 60 | 61 | 12. `password_generator.py`: Generate strong, random passwords of a specified length and complexity. 62 | 63 | 13. `rename_files_in_bulk.py`: Rename multiple files in a directory based on a specified pattern or convention. 64 | 65 | 14. `scan_open_ports.py`: Scan a network for open ports on specified hosts or IP ranges. 66 | 67 | ## Usage 68 | 69 | Each script has a corresponding `.bat` file for easy execution on Windows systems. Double-click the `.bat` file and follow the prompts to provide the necessary inputs. 70 | 71 | For Linux and macOS users, run the Python scripts directly from the command line: 72 | 73 | ```bash 74 | python script_name.py 75 | ``` 76 | 77 | Replace `script_name.py` with the actual name of the script you want to run. 78 | 79 | ## Customization 80 | 81 | Feel free to modify and customize the scripts to suit your specific needs. You can add additional features, change the input prompts, or integrate the scripts into your existing workflows. 82 | 83 | ## Contributing 84 | 85 | Contributions to the Python-Scripts collection are welcome! If you have any ideas for new scripts or improvements to existing ones, please submit a pull request or open an issue on the [GitHub repository](https://github.com/nazpins/naztech-software/edit/main/python-scripts). 86 | 87 | ## License 88 | 89 | This project is licensed under the [MIT License](LICENSE). 90 | 91 | ## Disclaimer 92 | 93 | Please use these scripts responsibly and ensure that you have the necessary permissions and backups before running them. The author of these scripts is not responsible for any data loss, security breaches, or other issues that may arise from the use of these scripts. 94 | 95 | --- -------------------------------------------------------------------------------- /python-scripts/backup_files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p src_dir="Enter the source directory path: " 3 | set /p dst_dir="Enter the destination directory path: " 4 | set /p encrypt_files="Do you want to encrypt the backup files? (y/n): " 5 | python backup_files.py %src_dir% %dst_dir% %encrypt_files% 6 | pause -------------------------------------------------------------------------------- /python-scripts/backup_files.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from cryptography.fernet import Fernet 4 | 5 | def backup_files(src_dir, dst_dir, encrypt=False): 6 | if not os.path.exists(dst_dir): 7 | os.makedirs(dst_dir) 8 | 9 | if encrypt: 10 | key = Fernet.generate_key() 11 | fernet = Fernet(key) 12 | with open(os.path.join(dst_dir, 'key.key'), 'wb') as key_file: 13 | key_file.write(key) 14 | 15 | for item in os.listdir(src_dir): 16 | src_path = os.path.join(src_dir, item) 17 | dst_path = os.path.join(dst_dir, item) 18 | 19 | if os.path.isfile(src_path): 20 | if encrypt: 21 | with open(src_path, 'rb') as file: 22 | original = file.read() 23 | encrypted = fernet.encrypt(original) 24 | with open(dst_path + '.enc', 'wb') as encrypted_file: 25 | encrypted_file.write(encrypted) 26 | else: 27 | shutil.copy2(src_path, dst_path) 28 | elif os.path.isdir(src_path): 29 | backup_files(src_path, dst_path, encrypt) 30 | 31 | if __name__ == '__main__': 32 | src_dir = input("Enter the source directory path: ") 33 | dst_dir = input("Enter the destination directory path: ") 34 | encrypt_files = input("Do you want to encrypt the backup files? (y/n): ").lower() == 'y' 35 | backup_files(src_dir, dst_dir, encrypt_files) 36 | print("Backup completed successfully.") -------------------------------------------------------------------------------- /python-scripts/compare_file_contents.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p file1="Enter the path to the first file: " 3 | set /p file2="Enter the path to the second file: " 4 | python compare_file_contents.py %file1% %file2% 5 | pause -------------------------------------------------------------------------------- /python-scripts/compare_file_contents.py: -------------------------------------------------------------------------------- 1 | import filecmp 2 | 3 | def compare_files(file1, file2): 4 | if filecmp.cmp(file1, file2): 5 | print("The files are identical.") 6 | else: 7 | print("The files are different.") 8 | 9 | if __name__ == '__main__': 10 | file1 = input("Enter the path to the first file: ") 11 | file2 = input("Enter the path to the second file: ") 12 | compare_files(file1, file2) -------------------------------------------------------------------------------- /python-scripts/create_conda_env.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p env_name="Enter the name of the Conda environment: " 3 | python create_conda_env.py %env_name% 4 | pause -------------------------------------------------------------------------------- /python-scripts/create_conda_env.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | def create_conda_env(env_name): 4 | subprocess.run(["conda", "create", "-n", env_name, "python=3.9", "-y"]) 5 | subprocess.run(["conda", "activate", env_name]) 6 | subprocess.run(["conda", "install", "numpy", "pandas", "scikit-learn", "-y"]) 7 | print(f"Conda environment '{env_name}' created and activated.") 8 | 9 | if __name__ == '__main__': 10 | env_name = input("Enter the name of the Conda environment: ") 11 | create_conda_env(env_name) -------------------------------------------------------------------------------- /python-scripts/encrypt_decrypt_files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p file_path="Enter the file path to encrypt/decrypt: " 3 | set /p key_path="Enter the path to the key file: " 4 | set /p action="Enter 'encrypt' to encrypt the file or 'decrypt' to decrypt the file: " 5 | python encrypt_decrypt_files.py %file_path% %key_path% %action% 6 | pause -------------------------------------------------------------------------------- /python-scripts/encrypt_decrypt_files.py: -------------------------------------------------------------------------------- 1 | import os 2 | from cryptography.fernet import Fernet 3 | 4 | def encrypt_file(file_path, key): 5 | with open(file_path, 'rb') as file: 6 | original = file.read() 7 | fernet = Fernet(key) 8 | encrypted = fernet.encrypt(original) 9 | with open(file_path + '.enc', 'wb') as encrypted_file: 10 | encrypted_file.write(encrypted) 11 | 12 | def decrypt_file(file_path, key): 13 | with open(file_path, 'rb') as encrypted_file: 14 | encrypted = encrypted_file.read() 15 | fernet = Fernet(key) 16 | decrypted = fernet.decrypt(encrypted) 17 | with open(file_path[:-4], 'wb') as decrypted_file: 18 | decrypted_file.write(decrypted) 19 | 20 | if __name__ == '__main__': 21 | file_path = input("Enter the file path to encrypt/decrypt: ") 22 | key_path = input("Enter the path to the key file: ") 23 | with open(key_path, 'rb') as key_file: 24 | key = key_file.read() 25 | action = input("Enter 'encrypt' to encrypt the file or 'decrypt' to decrypt the file: ") 26 | if action == 'encrypt': 27 | encrypt_file(file_path, key) 28 | print("File encrypted successfully.") 29 | elif action == 'decrypt': 30 | decrypt_file(file_path, key) 31 | print("File decrypted successfully.") 32 | else: 33 | print("Invalid action. Please enter 'encrypt' or 'decrypt'.") -------------------------------------------------------------------------------- /python-scripts/generate_data_reports.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p data_source="Enter the data source (csv/excel): " 3 | set /p output_format="Enter the desired output format (csv/excel): " 4 | python generate_data_reports.py %data_source% %output_format% 5 | pause -------------------------------------------------------------------------------- /python-scripts/generate_data_reports.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | def generate_report(data_source, output_format): 4 | if data_source == 'csv': 5 | file_path = input("Enter the path to the CSV file: ") 6 | data = pd.read_csv(file_path) 7 | elif data_source == 'excel': 8 | file_path = input("Enter the path to the Excel file: ") 9 | sheet_name = input("Enter the sheet name: ") 10 | data = pd.read_excel(file_path, sheet_name=sheet_name) 11 | else: 12 | print("Unsupported data source. Please provide a CSV or Excel file.") 13 | return 14 | 15 | if output_format == 'csv': 16 | output_path = input("Enter the output file path: ") 17 | data.to_csv(output_path, index=False) 18 | print("Report generated successfully.") 19 | elif output_format == 'excel': 20 | output_path = input("Enter the output file path: ") 21 | data.to_excel(output_path, index=False) 22 | print("Report generated successfully.") 23 | else: 24 | print("Unsupported output format. Please choose 'csv' or 'excel'.") 25 | 26 | if __name__ == '__main__': 27 | data_source = input("Enter the data source (csv/excel): ") 28 | output_format = input("Enter the desired output format (csv/excel): ") 29 | generate_report(data_source, output_format) -------------------------------------------------------------------------------- /python-scripts/manage_user_accounts.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p action="Enter 'create', 'modify', or 'delete' to manage user accounts: " 3 | set /p username="Enter the username: " 4 | if "%action%"=="create" ( 5 | python manage_user_accounts.py create %username% 6 | ) else if "%action%"=="modify" ( 7 | set /p new_password="Enter the new password: " 8 | python manage_user_accounts.py modify %username% %new_password% 9 | ) else if "%action%"=="delete" ( 10 | python manage_user_accounts.py delete %username% 11 | ) else ( 12 | echo Invalid action. Please enter 'create', 'modify', or 'delete'. 13 | ) 14 | pause -------------------------------------------------------------------------------- /python-scripts/manage_user_accounts.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def create_user(username): 4 | os.system(f"net user {username} /add") 5 | print(f"User '{username}' created successfully.") 6 | 7 | def modify_user(username, new_password): 8 | os.system(f"net user {username} {new_password}") 9 | print(f"User '{username}' modified successfully.") 10 | 11 | def delete_user(username): 12 | os.system(f"net user {username} /delete") 13 | print(f"User '{username}' deleted successfully.") 14 | 15 | if __name__ == '__main__': 16 | action = input("Enter 'create', 'modify', or 'delete' to manage user accounts: ") 17 | username = input("Enter the username: ") 18 | if action == 'create': 19 | create_user(username) 20 | elif action == 'modify': 21 | new_password = input("Enter the new password: ") 22 | modify_user(username, new_password) 23 | elif action == 'delete': 24 | delete_user(username) 25 | else: 26 | print("Invalid action. Please enter 'create', 'modify', or 'delete'.") -------------------------------------------------------------------------------- /python-scripts/merge_csv_files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | python merge_csv_files.py 3 | pause -------------------------------------------------------------------------------- /python-scripts/merge_csv_files.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import os 3 | 4 | def merge_csv_files(file_list, output_file): 5 | merged_data = pd.concat([pd.read_csv(file) for file in file_list]) 6 | merged_data.to_csv(output_file, index=False) 7 | print("CSV files merged successfully.") 8 | 9 | if __name__ == '__main__': 10 | file_list = [] 11 | while True: 12 | file_path = input("Enter the path to a CSV file (or press Enter to finish): ") 13 | if file_path == '': 14 | break 15 | file_list.append(file_path) 16 | output_file = input("Enter the output file path: ") 17 | merge_csv_files(file_list, output_file) -------------------------------------------------------------------------------- /python-scripts/monitor_network_traffic.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p interval="Enter the monitoring interval (in seconds): " 3 | python monitor_network_traffic.py %interval% 4 | pause -------------------------------------------------------------------------------- /python-scripts/monitor_network_traffic.py: -------------------------------------------------------------------------------- 1 | import psutil 2 | import time 3 | 4 | def monitor_network_traffic(interval=1): 5 | prev_sent = psutil.net_io_counters().bytes_sent 6 | prev_recv = psutil.net_io_counters().bytes_recv 7 | while True: 8 | time.sleep(interval) 9 | sent = psutil.net_io_counters().bytes_sent 10 | recv = psutil.net_io_counters().bytes_recv 11 | sent_speed = (sent - prev_sent) / interval 12 | recv_speed = (recv - prev_recv) / interval 13 | print(f"Sent: {sent_speed / 1024:.2f} KB/s, Received: {recv_speed / 1024:.2f} KB/s") 14 | prev_sent = sent 15 | prev_recv = recv 16 | 17 | if __name__ == '__main__': 18 | interval = int(input("Enter the monitoring interval (in seconds): ")) 19 | monitor_network_traffic(interval) -------------------------------------------------------------------------------- /python-scripts/monitor_process_memory.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p process_name="Enter the process name to monitor: " 3 | set /p interval="Enter the monitoring interval (in seconds): " 4 | python monitor_process_memory.py %process_name% %interval% 5 | pause -------------------------------------------------------------------------------- /python-scripts/monitor_process_memory.py: -------------------------------------------------------------------------------- 1 | import psutil 2 | import time 3 | 4 | def monitor_process_memory(process_name, interval=1): 5 | while True: 6 | for proc in psutil.process_iter(['name']): 7 | if proc.info['name'] == process_name: 8 | mem_usage = proc.memory_info().rss / (1024 * 1024) 9 | print(f"{process_name} memory usage: {mem_usage:.2f} MB") 10 | time.sleep(interval) 11 | 12 | if __name__ == '__main__': 13 | process_name = input("Enter the process name to monitor: ") 14 | interval = int(input("Enter the monitoring interval (in seconds): ")) 15 | monitor_process_memory(process_name, interval) -------------------------------------------------------------------------------- /python-scripts/monitor_system_resources.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p interval="Enter the monitoring interval (in seconds): " 3 | python monitor_system_resources.py %interval% 4 | pause -------------------------------------------------------------------------------- /python-scripts/monitor_system_resources.py: -------------------------------------------------------------------------------- 1 | import psutil 2 | import time 3 | 4 | def monitor_system_resources(interval=1): 5 | while True: 6 | cpu_percent = psutil.cpu_percent() 7 | mem_percent = psutil.virtual_memory().percent 8 | disk_percent = psutil.disk_usage('/').percent 9 | print(f"CPU Usage: {cpu_percent}%, Memory Usage: {mem_percent}%, Disk Usage: {disk_percent}%") 10 | time.sleep(interval) 11 | 12 | if __name__ == '__main__': 13 | interval = int(input("Enter the monitoring interval (in seconds): ")) 14 | monitor_system_resources(interval) -------------------------------------------------------------------------------- /python-scripts/organize_files_by_type.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Prompt the user for the directory path 4 | set /p directory="Enter the directory path: " 5 | 6 | REM Run the Python script with the provided directory path 7 | python organize_files_by_type.py "%directory%" 8 | 9 | pause -------------------------------------------------------------------------------- /python-scripts/organize_files_by_type.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | def organize_files_by_type(directory): 5 | # Dictionary to store the mapping of file extensions to folder names 6 | extension_folders = { 7 | '.jpg': 'Images', 8 | '.jpeg': 'Images', 9 | '.png': 'Images', 10 | '.gif': 'Images', 11 | '.bmp': 'Images', 12 | '.txt': 'Documents', 13 | '.doc': 'Documents', 14 | '.docx': 'Documents', 15 | '.pdf': 'Documents', 16 | '.xlsx': 'Documents', 17 | '.csv': 'Documents', 18 | '.md': 'Documents', 19 | '.epub': 'Documents', 20 | '.mobi': 'Documents', 21 | '.mp3': 'Audio', 22 | '.wav': 'Audio', 23 | '.flac': 'Audio', 24 | '.aac': 'Audio', 25 | '.mp4': 'Videos', 26 | '.avi': 'Videos', 27 | '.mkv': 'Videos', 28 | '.mov': 'Videos', 29 | '.exe': 'Applications', 30 | '.msi': 'Applications', 31 | '.zip': 'Archives', 32 | '.rar': 'Archives', 33 | '.7z': 'Archives', 34 | '.tar': 'Archives', 35 | '.gz': 'Archives' 36 | } 37 | 38 | # Iterate over the files in the directory 39 | for filename in os.listdir(directory): 40 | file_path = os.path.join(directory, filename) 41 | 42 | # Check if the item is a file 43 | if os.path.isfile(file_path): 44 | # Get the file extension 45 | _, extension = os.path.splitext(filename) 46 | extension = extension.lower() 47 | 48 | # Check if the file extension exists in the mapping 49 | if extension in extension_folders: 50 | # Get the destination folder name 51 | folder_name = extension_folders[extension] 52 | 53 | # Create the destination folder if it doesn't exist 54 | folder_path = os.path.join(directory, folder_name) 55 | os.makedirs(folder_path, exist_ok=True) 56 | 57 | # Move the file to the destination folder 58 | destination_path = os.path.join(folder_path, filename) 59 | shutil.move(file_path, destination_path) 60 | print(f"Moved {filename} to {folder_name} folder.") 61 | else: 62 | # Create an 'Other' folder for files with unknown extensions 63 | other_folder = os.path.join(directory, 'Other') 64 | os.makedirs(other_folder, exist_ok=True) 65 | 66 | # Move the file to the 'Other' folder 67 | destination_path = os.path.join(other_folder, filename) 68 | shutil.move(file_path, destination_path) 69 | print(f"Moved {filename} to Other folder.") 70 | else: 71 | print(f"{filename} is not a file. Skipping.") 72 | 73 | print("File organization completed.") 74 | 75 | if __name__ == '__main__': 76 | # Prompt the user for the directory path 77 | directory = input("Enter the directory path: ") 78 | 79 | # Call the function to organize files by type 80 | organize_files_by_type(directory) -------------------------------------------------------------------------------- /python-scripts/password_generator.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p length="Enter the desired password length: " 3 | python password_generator.py %length% 4 | pause -------------------------------------------------------------------------------- /python-scripts/password_generator.py: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | def generate_password(length=12): 5 | characters = string.ascii_letters + string.digits + string.punctuation 6 | password = ''.join(random.choice(characters) for _ in range(length)) 7 | return password 8 | 9 | if __name__ == '__main__': 10 | length = int(input("Enter the desired password length: ")) 11 | password = generate_password(length) 12 | print("Generated Password:", password) -------------------------------------------------------------------------------- /python-scripts/rename_files_in_bulk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p directory="Enter the directory path: " 3 | set /p old_pattern="Enter the old pattern to replace: " 4 | set /p new_pattern="Enter the new pattern: " 5 | python rename_files_in_bulk.py %directory% %old_pattern% %new_pattern% 6 | pause -------------------------------------------------------------------------------- /python-scripts/rename_files_in_bulk.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def rename_files(directory, old_pattern, new_pattern): 4 | for filename in os.listdir(directory): 5 | if old_pattern in filename: 6 | new_filename = filename.replace(old_pattern, new_pattern) 7 | old_path = os.path.join(directory, filename) 8 | new_path = os.path.join(directory, new_filename) 9 | os.rename(old_path, new_path) 10 | print("Files renamed successfully.") 11 | 12 | if __name__ == '__main__': 13 | directory = input("Enter the directory path: ") 14 | old_pattern = input("Enter the old pattern to replace: ") 15 | new_pattern = input("Enter the new pattern: ") 16 | rename_files(directory, old_pattern, new_pattern) -------------------------------------------------------------------------------- /python-scripts/scan_open_ports.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set /p target="Enter the target IP address: " 3 | set /p start_port="Enter the starting port number: " 4 | set /p end_port="Enter the ending port number: " 5 | python scan_open_ports.py %target% %start_port% %end_port% 6 | pause -------------------------------------------------------------------------------- /python-scripts/scan_open_ports.py: -------------------------------------------------------------------------------- 1 | import socket 2 | 3 | def scan_ports(target, start_port, end_port): 4 | print(f"Scanning {target} for open ports...") 5 | for port in range(start_port, end_port + 1): 6 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 7 | sock.settimeout(1) 8 | result = sock.connect_ex((target, port)) 9 | if result == 0: 10 | print(f"Port {port} is open") 11 | sock.close() 12 | 13 | if __name__ == '__main__': 14 | target = input("Enter the target IP address: ") 15 | start_port = int(input("Enter the starting port number: ")) 16 | end_port = int(input("Enter the ending port number: ")) 17 | scan_ports(target, start_port, end_port) -------------------------------------------------------------------------------- /windows-scripts/README.md: -------------------------------------------------------------------------------- 1 | # Windows Scripts 2 | 3 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 4 | [![Windows](https://img.shields.io/badge/Windows-0078D6?logo=windows&logoColor=white)](https://www.microsoft.com/en-us/windows) 5 | 6 | --- 7 | 8 | **I'm still finishing these but they will be updated in the next few days!** 9 | 10 | --- 11 | 12 | A curated collection of useful scripts for Windows power users, focusing on machine learning, automation, data sorting, security, and workflow improvements. These scripts are designed to streamline tasks, enhance productivity, and provide convenient utilities for various system management and file manipulation operations. 13 | 14 | ## Table of Contents 15 | 16 | - [Scripts](#scripts) 17 | - [Getting Started](#getting-started) 18 | - [Prerequisites](#prerequisites) 19 | - [Installation](#installation) 20 | - [Usage](#usage) 21 | - [Customization](#customization) 22 | - [Contributing](#contributing) 23 | - [License](#license) 24 | - [Disclaimer](#disclaimer) 25 | 26 | ## Scripts 27 | 28 | 1. `block_exe_files_firewall.bat`: Blocks all .exe files in the current directory and its subdirectories using Windows Firewall. 29 | 30 | 2. `list_installed_apps_with_winget.bat`: Lists all installed applications and their corresponding winget install commands, saving the output to a text file. 31 | 32 | 3. `list_winget_install_commands.bat`: Lists only the winget install commands for all installed applications, saving the output to a text file. 33 | 34 | 4. `add_miniconda3_to_path.bat`: Adds Miniconda3 to the system's PATH environment variable. 35 | 36 | 5. `open_apps_folder.bat`: Opens the Windows Apps folder in File Explorer. 37 | 38 | 6. `restart_explorer.bat`: Restarts the Windows Explorer process. 39 | 40 | 7. `toggle_hidden_files.bat`: Toggles the visibility of hidden files and folders in Windows Explorer. 41 | 42 | 8. `create_system_restore_point.bat`: Creates a system restore point using PowerShell. 43 | 44 | 9. `update_all_apps.bat`: Updates all installed applications using the Windows Package Manager (winget). 45 | 46 | 10. `find_large_files.bat`: Finds all files larger than a specified size (default: 1 GB) in the current directory and its subdirectories, and outputs the list of files with their full paths and sizes to a text file. 47 | 48 | 11. `clean_temp_files.bat`: Cleans up the user's temporary files directory by deleting all files and subdirectories within it. 49 | 50 | 12. `reset_network_adapter.bat`: Resets the network adapter settings by releasing and renewing the IP address, flushing the DNS cache, and resetting the Winsock catalog and IP settings. 51 | 52 | 13. `enable_god_mode.bat`: Creates a special folder on the desktop named "GodMode" that provides quick access to various system settings and tools. 53 | 54 | 14. `list_installed_drivers.bat`: Generates a detailed list of all installed drivers on the system and saves it to a text file. 55 | 56 | 15. `monitor_cpu_usage.bat`: Continuously monitors the CPU usage and displays the current percentage in real-time, refreshing every second. 57 | 58 | 16. `find_duplicate_files.bat`: Finds all duplicate files in the current directory and its subdirectories based on their names and sizes, and outputs the list of duplicate files to a text file. 59 | 60 | 17. `list_installed_fonts.bat`: Generates a list of all installed fonts on the system and saves it to a text file. 61 | 62 | 18. `change_file_extensions.bat`: Changes the file extension of all files in the current directory from one extension to another (e.g., .txt to .md). 63 | 64 | 19. `convert_images_to_pdf.bat`: Converts all JPG images in the current directory into a single PDF file using PowerShell. 65 | 66 | 20. `backup_user_folders.bat`: Creates a backup of the user's essential folders (Desktop, Documents, Pictures, Videos, and Music) in a "Backup" directory within the user's Documents folder. 67 | 68 | ## Getting Started 69 | 70 | ### Prerequisites 71 | 72 | - Windows operating system (Windows 7 or later) 73 | - PowerShell (included in Windows by default) 74 | - Windows Package Manager (winget) for certain scripts (optional) 75 | 76 | ### Installation 77 | 78 | 1. Clone the repository: 79 | 80 | ```bash 81 | git clone https://github.com/nazpins/naztech-software/main/windows-scripts.git 82 | ``` 83 | 84 | 2. You're ready to use the scripts! Double-click the `.bat` file and follow the prompts to provide the necessary inputs. 85 | 86 | ## Usage 87 | 88 | To run a script, simply double-click on the corresponding `.bat` file or execute it from the command prompt. Follow the prompts or instructions provided by each script, if any. 89 | 90 | Please note that some scripts may modify your files or system settings. It is recommended to create backups before running them and to use them with caution. 91 | 92 | ## Customization 93 | 94 | Feel free to modify and customize the scripts to suit your specific needs. You can add additional features, change the input prompts, or integrate the scripts into your existing workflows. 95 | 96 | ## Contributing 97 | 98 | Contributions to the Windows-Scripts collection are welcome! If you have any ideas for new scripts or improvements to existing ones, please submit a pull request or open an issue on the [GitHub repository](https://github.com/nazpins/naztech-software/main/windows-scripts). 99 | 100 | ## License 101 | 102 | This project is licensed under the [MIT License](LICENSE). 103 | 104 | ## Disclaimer 105 | 106 | Please use these scripts responsibly and ensure that you have the necessary permissions and backups before running them. The author of these scripts is not responsible for any data loss, security breaches, or other issues that may arise from the use of these scripts. 107 | 108 | --- 109 | 110 | **Note**: Some scripts may require administrative privileges to run successfully. -------------------------------------------------------------------------------- /windows-scripts/add_miniconda3_to_path.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SETX PATH "%PATH%;C:\ProgramData\miniconda3;C:\ProgramData\miniconda3\Scripts;C:\ProgramData\miniconda3\Library\bin" 3 | pause -------------------------------------------------------------------------------- /windows-scripts/block_exe_files_firewall.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enableextensions 3 | cd /d "%~dp0" 4 | 5 | for /R %%f in (*.exe) do ( 6 | netsh advfirewall firewall add rule name="Blocked: %%f" dir=out program="%%f" action=block 7 | ) 8 | pause -------------------------------------------------------------------------------- /windows-scripts/create_system_restore_point.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -ExecutionPolicy Bypass -Command "Checkpoint-Computer -Description 'Manual Restore Point' -RestorePointType 'MODIFY_SETTINGS'" 3 | pause -------------------------------------------------------------------------------- /windows-scripts/find_large_files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set "size=1000000000" 3 | set "outputFile=large_files.txt" 4 | powershell -ExecutionPolicy Bypass -Command "Get-ChildItem -Recurse -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt %size%} | Select-Object FullName,Length | Out-File -FilePath '%outputFile%'" 5 | echo Done. Check the file '%outputFile%' for the list of large files. 6 | pause -------------------------------------------------------------------------------- /windows-scripts/list_installed_apps_with_winget.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal EnableDelayedExpansion 3 | 4 | REM Output file 5 | set "outputFile=installed_apps_with_winget.txt" 6 | 7 | REM Clear the output file if it exists 8 | if exist "%outputFile%" del "%outputFile%" 9 | 10 | REM List all installed apps 11 | for /f "tokens=*" %%a in ('powershell "Get-AppxPackage | Select-Object Name"') do ( 12 | set "appName=%%a" 13 | REM Remove the 'Name' prefix from the output 14 | set "cleanAppName=!appName:Name=!" 15 | 16 | REM Check if the app name is not empty and not a header 17 | if not "!cleanAppName!"=="" if not "!cleanAppName!"=="----" ( 18 | REM Output the app name and the winget install command 19 | echo !cleanAppName! >> "%outputFile%" 20 | echo winget install !cleanAppName! >> "%outputFile%" 21 | echo. >> "%outputFile%" 22 | ) 23 | ) 24 | 25 | echo Done. Check the file '%outputFile%' for the list and commands. 26 | pause -------------------------------------------------------------------------------- /windows-scripts/list_winget_install_commands.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal EnableDelayedExpansion 3 | 4 | REM Output file 5 | set "outputFile=winget_install_commands.txt" 6 | 7 | REM Clear the output file if it exists 8 | if exist "%outputFile%" del "%outputFile%" 9 | 10 | REM List all installed apps 11 | for /f "tokens=*" %%a in ('powershell "Get-AppxPackage | Select-Object Name"') do ( 12 | set "appName=%%a" 13 | REM Remove the 'Name' prefix from the output 14 | set "cleanAppName=!appName:Name=!" 15 | 16 | REM Check if the app name is not empty and not a header 17 | if not "!cleanAppName!"=="" if not "!cleanAppName!"=="----" ( 18 | REM Output only the winget install command 19 | echo winget install !cleanAppName! >> "%outputFile%" 20 | ) 21 | ) 22 | 23 | echo Done. Check the file '%outputFile%' for the commands. 24 | pause -------------------------------------------------------------------------------- /windows-scripts/open_apps_folder.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | start shell:AppsFolder -------------------------------------------------------------------------------- /windows-scripts/restart_explorer.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | taskkill /f /im explorer.exe 3 | start explorer.exe -------------------------------------------------------------------------------- /windows-scripts/toggle_hidden_files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden | find "0x1" > nul 3 | if %errorlevel% == 0 ( 4 | reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t REG_DWORD /d 0 /f 5 | echo Hidden files and folders are now visible. 6 | ) else ( 7 | reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t REG_DWORD /d 1 /f 8 | echo Hidden files and folders are now hidden. 9 | ) 10 | pause -------------------------------------------------------------------------------- /windows-scripts/update_all_apps.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | winget upgrade --all 3 | pause --------------------------------------------------------------------------------