Skip to content

Directory Cleaner is a Python tool to automate directory cleanup. Users can delete specific file types (e.g., .pdf, .txt) or remove all contents (files and subfolders) of a directory. The tool prompts for confirmation before deletion and logs all actions to a deletion_log.txt file. It's a simple and efficient solution for managing file systems.

License

Notifications You must be signed in to change notification settings

Nandhu-Ramesh-07/Directory-Cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directory Cleaner

Directory Cleaner is a Python tool that helps you clean up files and folders in a directory based on your specifications. It allows you to delete files of a certain type (e.g., PDFs) or even delete entire folders within a directory.

Features

  • Delete files of a specific type (e.g., PDFs, text files, etc.).
  • Delete all folders inside a specified directory.
  • Safe deletion with a confirmation prompt before proceeding.

Installation

To use Directory Cleaner, you need to clone the repository and install its dependencies.

  1. Clone the repository:

    git clone https://github.com/your-username/directory-cleaner.git
    cd directory-cleaner
  2. Install required dependencies (if any):

    pip install -r requirements.txt

Usage

Import the Function

After setting up the project, you can use the cleaning function in your Python script. You will need to import it as shown below:

from residual_cleaner import cleaner

Clean Files or Folders

You can call the cleaner() function with the following options:

  • Delete files of a specific type (e.g., PDF files).
  • Delete entire folders inside the directory.

Example Usage

from residual_cleaner import cleaner

# Specify the directory you want to clean
directory = '/path/to/your/directory'

# Delete all PDF files in the directory
cleaner(directory=directory, kind='pdf')

# Delete all folders inside the directory
cleaner(directory=directory, kind='entire')

Parameters

  • kind: Specifies what to delete.
    • kind='pdf': Deletes all .pdf files in the directory.
    • kind='entire': Deletes all folders inside the directory.
  • directory: The path to the directory you want to clean.

Warning

Before deleting any files or folders, you will be prompted to confirm the action. A message will be displayed asking for a yes or no response to proceed with the deletion.

Warning: This will delete all files/folders. Are you sure? (yes/no)

Type yes to proceed, or no to cancel.

About

Directory Cleaner is a Python tool to automate directory cleanup. Users can delete specific file types (e.g., .pdf, .txt) or remove all contents (files and subfolders) of a directory. The tool prompts for confirmation before deletion and logs all actions to a deletion_log.txt file. It's a simple and efficient solution for managing file systems.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages