Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # Filename: bin_metadata.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- """
- This script scans the recycle bin for deleted file metadata.
- Requirements:
- - Python 3.x
- - Operating system supporting the $Recycle.Bin directory structure
- Functions:
- - scan_recycle_bin(): Scans the recycle bin directory for deleted file metadata.
- - main(): Main function to execute the script.
- Usage:
- 1. Ensure Python 3.x is installed on your system.
- 2. Run the script using the command: python bin_metadata.py
- Additional Notes:
- - This script does not delete or edit any files, it only scans for metadata.
- - Elevated privileges may be required to access system directories, especially on Windows.
- - The script outputs the path of deleted file metadata found in the recycle bin.
- - Use caution when interacting with system directories to avoid unintentional modifications.
- """
- import os
- def scan_recycle_bin():
- """
- Scans the recycle bin directory for deleted file metadata.
- Returns:
- List: A list containing the paths of deleted file metadata found in the recycle bin.
- """
- recycle_bin_path = os.path.join('C:', '\\$Recycle.Bin')
- if not os.path.exists(recycle_bin_path):
- print("\nRecycle bin directory not found!\n")
- return []
- print("\nRecycle bin directory found!\n\nDeleted File Metadata Content:\n")
- deleted_files = []
- for root, dirs, files in os.walk(recycle_bin_path):
- for file in files:
- deleted_files.append(os.path.join(root, file))
- print(os.path.join(root, file))
- for directory in dirs:
- deleted_files.append(os.path.join(root, directory))
- print(os.path.join(root, directory))
- return deleted_files
- def main():
- """
- Main function to execute the script.
- """
- # Scan recycle bin for deleted files
- deleted_files = scan_recycle_bin()
- if deleted_files:
- print(f"\nFound {len(deleted_files)} deleted file metadata in the recycle bin.\n")
- else:
- print("\nNo deleted file metadata found!\n")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement