Skip to main content

ofacd - Organize files and clean directories

Create a directory tree and rules for files that will be moved to there Create a directory structre

from ofacd import DirectoryStructure

ds = DirectoryStructure('z_l0')
ds.add((
	'a_l1', ('b_l2', 'c_l2', ('d_l3', 'e_l3')),
))
ds.add((((('f_l1',)))))

# print(ds.dirs)
# [
# 	PosixPath('z_l0/a_l1/b_l2'),
# 	PosixPath('z_l0/a_l1/c_l2/d_l3'),
# 	PosixPath('z_l0/a_l1/c_l2/e_l3'),
# 	PosixPath('z_l0/f_l1')
# ]

ds.create()

Add rules to the directory, rules will affect directories and files in it

from ofacd import Rule

rule = Rule(path='.')

rule.set_dir_rules(lambda x: x.title())
rule.set_file_rules(lambda x: x.lower())
rule.add(lambda x: x.replace('_', '__'))

rule.execute()

Install

pip install ofacd
# or
pip install git+https://github.com/ames0k0/ofacd

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ofacd-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file ofacd-0.1.0.tar.gz.

File metadata

  • Download URL: ofacd-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for ofacd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63523cc520049ae41fedcf70c6c368fe617d37d6520bdaf17ca8a5f42420b95e
MD5 d7ee33435e862e68252b79355bedcfb8
BLAKE2b-256 ce83b9c84183d4796cb1f9fd1af16c47b21de78f31ef58c15ec92277a63d9cb6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page