Giter VIP home page Giter VIP logo

filedate's Introduction

ใ€€

ใ€€ใ€€

Description ๐Ÿ“

Simple, convenient and cross-platform file date changing library. ๐Ÿ“…

Installation ๐Ÿ–ฅ๏ธ

  1. git (recommended)
git clone git://github.com/kubinka0505/filedate
cd filedate/Files
python setup.py install

Tip

You can alse use this ugly one-liner for most recent commits:

python -m pip install "git+https://github.com/kubinka0505/filedate#egg=filedate&subdirectory=Files" -U --use-deprecated=legacy-resolver
  1. pip
python -m pip install filedate -U

Usage ๐Ÿ“

import filedate

# Create filedate object
File = filedate.File("~/Desktop/File.txt")

# Get file date
File.get_dates()

# Alternatives
dir(File)
File.created, File.modified, File.accessed

# Set file date
File.created  = "01.01.2000 12:00"
File.modified = "3:30PM 2001/02/02"
File.accessed = "3rd March 2002 20:00:30"

# Legacy
File.set(
    created  = "01.01.2000 12:00",
    modified = "3:30PM 2001/02/02",
    accessed = "3rd March 2002 20:00:30"
)
Copy file dates from one to another ๐Ÿ”ƒ
import filedate

filedate.copy(
    "~/Desktop/Input.mp4", "~/Desktop/Output.mp4",
    created = True,
    modified = True,
    accessed = True
)
Keeping files dates โŒ›
import filedate
from pathlib import Path

# Get all files in subdirectories (recursive!)
Files = []
for File in Path(".").glob("**/*"):
    File = str(File.resolve())
    Files.append(File)

#-=-=-=-#

# Initialize `Keep` object
dates = filedate.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()
Set file dates based on its name (beta) ๐Ÿ“
from filedate import utils

utils.set_from.file_name(
    "~/Downloads/20200919_134705.wav",
    created = True,
    modified = False,
    accessed = True,
)

filedate's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

filedate's Issues

Add possibility to use it in folders

Trying to use it in folders (windows), it produces a strange behavior, the "details" view shows the date correctly, but in properties it shows the actual date of creation of the folder.

Issue with os.path.expandvars and odd filenames

I stumbled upon this pretty recently, and thought to make a post to see if it was something the maintainers were interested in.

When instantiating a File class, if the file path has the substring "$$" somewhere in the path, it will be scrubbed by the init function for File due to os.path.expandvars.

Example:
Original path: "X:\TestFolder\TestSubFolder\check_request$$fromjim.pdf"
self.file in the class post initialization: Original path: "X:\TestFolder\TestSubFolder\check_request$fromjim.pdf"

I know this is probably a ridiculous edge case but technically "$$" is allowed in Windows for a document name so it will cause the file to not be found by the library.

This can be worked around by overriding the "file" property on the class in my testing.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.