File Count by Date is a Python script that counts the number of files in a specified directory grouped by their creation date. The script creates a dictionary that stores the count of files for each date and writes the results to a text file.
To use this script, follow the steps below:
Clone this repository by running the following command:
Copy code git clone https://github.com/your-username/file-count-by-date.git Navigate to the cloned directory using:
cd file-count-by-date
Install the required packages by running the following command:
pip install -r requirements.txt
To use this script, follow the steps below:
Open the file file_count_by_date.py in a text editor of your choice.
Modify the folder_path variable in the script to specify the directory you want to count the files for.
Open a terminal window in the project directory.
Copy code python file_count_by_date.py The results will be written to a file named result.txt in the directory specified by output_file_name.
Suppose we have a directory containing the following files:
file1.txt (created on 2022-01-01)
file2.txt (created on 2022-01-01)
file3.txt (created on 2022-01-02)
file4.txt (created on 2022-01-02)
file5.txt (created on 2022-01-03)
Running the script on this directory will create a file named result.txt with the following content:
Copy code
2022-01-01: 2
2022-01-02: 2
2022-01-03: 1
This indicates that there were 2 files created on January 1, 2022, 2 files created on January 2, 2022, and 1 file created on January 3, 2022.