Skip to main content

Organize files and clean directories

Project description

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

Project details


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 hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page