Simple, convenient and cross-platform file date changing library. 📅
git
(recommended)
git clone git://github.com/kubinka0505/filedate
cd filedate/Files
python setup.py install
python -m pip install filedate
import filedate
# Create filedate object
File_Date = filedate.File("~/Desktop/File.txt")
# Get file date
File_Date.get()
# Set file date
File_Date.set(
created = "01.01.2000 12:00",
modified = "3:30PM 2001/02/02",
accessed = "3rd March 2002 20:00:30"
)
from filedate.Utils import Copy
Copy("~/Desktop/Input.mp4", "~/Desktop/Output.mp4").all()
from pathlib import Path
from filedate import Utils
# Get all files in subdirectories (recursive!)
Files = []
for File in Path(".").glob("**/*"):
Files.append(File)
#---#
# Initialize `Keep` object
Dates = Utils.Keep(Files)
# Pick dates
Dates.pick()
# ... Do your stuff ...
#
# from os import system
# for File in Files:
# system(f'optimize -i "{File}"')
# Drop dates
Dates.drop()
from filedate.Utils import Name
# Sets creation date
Name("~/Downloads/20200919_134705.wav").created()
# Sets all file dates
Name("Recording_20010204_103503.mp3").all()