The range is random, including the creation time and modification time
This is a Python script designed to randomly set the access and modification timestamps for all files within a specified directory. The timestamps are randomly generated between user-specified start and end dates.
- Randomly sets file timestamps.
- Compatible with Windows operating systems.
- User-friendly command-line interface.
- Python 3.x
- Windows operating system
-
Ensure Python 3.x is installed on your system.
-
Save this script as a
.pyfile, for example,randomize_timestamps.py. -
Open Command Prompt or PowerShell and navigate to the directory where the script is located.
-
Run the script: python randomize_timestamps.py
-
Follow the prompts to enter the directory path and the date range.
folder_path: The path to the directory whose files' timestamps you want to update.start_date: The earliest possible date for the timestamps.end_date: The latest possible date for the timestamps.
After running the script, you will be prompted to enter the following information: Please enter the folder path: Please enter the earliest time (format like YYYY-MM-DD HH:MM:SS): Please enter the latest time (format like YYYY-MM-DD HH:MM:SS):
- Make sure you have the necessary permissions to modify the files in the specified directory.
- This script is only compatible with Windows operating systems as it uses the
win32filelibrary.
This project is licensed under the Apache-2.0 License.
This script is for educational and research purposes only. Please ensure you comply with all applicable laws and regulations when using it. The author assumes no responsibility for any loss or damage caused during its use.