All-in-one file manipulation
Project description
What is this?
An work-in-progress library for file manipulation in python.
(E.g. I was tired of copy-pasting my giant tool into each project)
How do I use this?
pip install file-system-py
import file_system_py as FS
*folders, name, extension = FS.path_pieces("/this/is/a/filepath.txt")
# folder[0] == '/' for absolute paths
FS.remove("./a folder")
FS.remove("./a file")
# 1. no error if they dont exist
# 2. doesnt care if file or folder
FS.extname("./thing/thing.stuff.blah.py")
# returns ".py"
# different ways to list
FS.list_paths_in("./thing/things")
FS.list_basenames_in("./thing/things")
FS.list_file_paths_in("./thing/things")
FS.list_folder_paths_in("./thing/things")
# returns [] when path doesnt exist or is a file
# much faster iterative versions
FS.iterate_paths_in(path)
FS.iterate_basenames_in(path)
FS.iterate_file_paths_in(path)
FS.iterate_folder_paths_in(path)
#
# full api
#
FS.walk_up_until(file_to_find, start_path=get_cwd())
FS.ensure_is_folder(path, force=True)
FS.ensure_is_file(path, force=True)
FS.make_relative_path(to=, coming_from=get_cwd())
FS.make_absolute_path(to, coming_from=get_cwd())
FS.move(item, to=, new_name=, force=True)
FS.copy(item, to=, new_name=, force=True)
FS.write(data, to=, force=True)
FS.is_folder(path)
FS.is_file(path)
FS.read(filepath)
FS.remove(path)
FS.exists(path)
FS.ls(path=".")
FS.list_paths_in(path)
FS.list_basenames_in(path)
FS.list_file_paths_in(path)
FS.list_folder_paths_in(path)
FS.iterate_paths_in(path)
FS.iterate_basenames_in(path)
FS.iterate_file_paths_in(path)
FS.iterate_folder_paths_in(path)
FS.glob(path)
FS.touch(path)
FS.touch_dir(path)
FS.parent_folder(path)
FS.basename(path)
FS.name(path)
FS.extname(path)
FS.path_pieces(path)
FS.join(*paths)
FS.is_absolute_path(path)
FS.is_relative_path(path)
FS.get_cwd()
FS.local_path(*paths)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
file_system_py-0.0.6.tar.gz
(4.2 kB
view details)
Built Distribution
File details
Details for the file file_system_py-0.0.6.tar.gz
.
File metadata
- Download URL: file_system_py-0.0.6.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 142b3e18fe075b2bcd20f0a1747fed7792dc1e7f6c7fe3dd904432044b588813 |
|
MD5 | 43fb317ced31a03261383405e2fbf5a7 |
|
BLAKE2b-256 | c2c46c862d9b88436315c638cadd1ffbe8bf6678b74b2859b3042841947c6850 |
File details
Details for the file file_system_py-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: file_system_py-0.0.6-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90aaa6b7e7e3b92c65cddae4c379f08f367d0983d71a3117c9be7ba48ecde0cd |
|
MD5 | 39564c618d673275d602e6cad889899b |
|
BLAKE2b-256 | d074dcc6753609ee09e2b556885d0c11dd652c46fb390108c386b0f9828e1adc |