Python package for file/directory/archive management.
Project description
filewrap
Python package for file/directory/archive management.
Python version 3.6 is required at a minimum.
To install/update the package with pip enter command in terminal:
pip install filewrap
To uninstall the package with pip enter command in terminal:
pip uninstall filewrap
Built-in modules used: os, tarfile, zipfile
Method | Description |
---|---|
copydir(destination_path, target_path)
|
Copy target directory and all of it's subdirectories/files to a destination directory. |
copyfile(destination_path, *filepaths)
|
Copy single/multiple files to destination directory. The destination_path and *filepaths arguments must be strings. |
read(filepath)
|
Read the binary from a file and return. The filepath argument must be a string. |
write(data, filepath)
|
Write bytes object to a file. The filepath argument must be a string. The data argument must be a bytes object. |
rpfile(mode, *filepaths)
|
Read and print lines in single/multiple text/binary based files. The mode argument must be either strings: 't' (text) or 'b' (binary). The *filepaths arguments must be strings. |
rmfile(*filepaths)
|
Delete single/multiple files. The *filepaths arguments must be strings. |
mkfile(mode, *filepaths)
|
Make single/multiple text/binary based files. The mode argument must be either strings: 't' (text) or 'b' (binary). The *filepaths arguments must be strings. |
rmdir(*filepaths)
|
Delete single/multiple directories. The *filepaths arguments must be strings. |
rmall(dirpath)
|
Delete single directory along with it's subdirectories and files. Use this with caution, as you could delete your entire file system if you're not careful. |
mkdir(*filepaths)
|
Make single/multiple directories. The *filepaths arguments must be strings. |
rpdir(*filepaths)
|
Output to terminal the file/subdirectory names of single/multiple argument filepaths. Use no arguments for working directory only. The *filepaths arguments must be strings. |
lsdir(filepath)
|
Return a list with file/subdirectory names of the single argument directory. If there is no argument used in filepath, a list of the contents (e.g. paths of files & directories) within the working directory is returned. If there is one argument used in filepath, a list of the contents of only that directory is returned. |
chdir(filepath)
|
Change current working directory. The filepath argument must be a string. |
wdir()
|
Return string of the path of the current working directory. |
pwdir()
|
Print working directory to terminal. |
mklist(*filepaths)
|
Return a list from lines in single/multiple text based files. The *filepaths arguments must be strings. |
writelines(filepath, *lines)
|
Write singular strings or lists of strings in sequence to lines in a text based file. The filepath argument must be a string. The lines in the file are overwritten by the lines argument values. |
appendlines(filepath, *lines)
|
Append singular strings or lists of strings in sequence to lines at the end of a text based file. The filepath argument must be a string. |
path_exists(filepath)
|
Return boolean value (True or False) to check if a single file path exists. The filepath argument must be a string. |
isfile(filepath)
|
Return boolean value (True or False) to check if filepath argument is a file. The filepath argument must be a string. |
isdir(filepath)
|
Return boolean value (True or False) to check if filepath argument is a directory. The filepath argument must be a string. |
istar(filepath)
|
Return boolean value (True or False) to check if filepath argument is a tar archive. The filepath argument must be a string. |
iszip(filepath)
|
Return boolean value (True or False) to check if filepath argument is a zip archive. The filepath argument must be a string. |
ren(current_filepath, desired_filepath)
|
Rename single/multiple files or directories. current_filepath represents the file path's name being changed. desired_filepath represents the file path's new intended name. current_filepath and desired_filepath can either be:
|
tar_wrap(filepath)
|
Create a tar archive with gzip compression & .gz extension. |
tar_extract(filepath)
|
Extract a tar gzip archive contents to working directory. |
zip_wrap(filepath)
|
Create a zip archive with DEFLATE compression. |
zip_extract(filepath)
|
Extract a zip archive contents to working directory. |
filecount(filepath)
|
Count and return the number of files within a directory. |
dircount(filepath)
|
Count and return the number of directories within a directory. |
size(*filepaths)
|
Get the total combined size in bytes of the file paths & directories within the *filepaths argument. |
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
filewrap-1.1.7.tar.gz
(6.5 kB
view details)
File details
Details for the file filewrap-1.1.7.tar.gz
.
File metadata
- Download URL: filewrap-1.1.7.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c57fccb8106206adeea9f2310515f43cb92f673c447695d9cb1bf9cbd6f7816 |
|
MD5 | e1a4a56993f0d20d08a6f91f40b5406e |
|
BLAKE2b-256 | db58e0c7a084af0354437609b6775339cb9b201d3ea9bc86a275e1bdc5c5a853 |