A CLI-tool for creating a complete copy of a directory and all it's subdirectories but with all files empty.
Project description
Emptycopy
Emptycopy is a Python CLI-tool that copies the contents of a folder and it's subfolder but leaves the files empty. It's useful for generating folder hierarchies for code tests or for examining how a command will affect a folder without actually changing the files.For example, the following folder structure:
$ tree -h my_folder/
[4.0K] my_folder/
├── [ 21K] file1.txt
├── [ 59K] file2.jpg
└── [4.0K] subfolder
└── [510K] file3.mp4
1 directory, 3 files
Becomes
$ tree -h empty_my_folder/
[4.0K] empty_my_folder/
├── [ 0] file1.txt
├── [ 0] file2.jpg
└── [4.0K] subfolder
└── [ 0] file3.mp4
1 directory, 3 files
Installation
pipx (Recommended)
Emptycopy can be installed using pipx, which is a tool to install Python CLI tools in isolated environments. This is the recommended way to install Emptycopy as it will not interfere with other Python packages on your system.
pipx install emptycopy
pip
Emptycopy can also be installed using pip, which is the Python package installer. This is not recommended as it will install Emptycopy globally on your system and may interfere with other Python packages.
pip install emptycopy
Usage
Once installed, Emptycopy can be run from the command line. The basic usage is as follows:
emptycopy <source> <destination>
Where <source>
is the path to the folder you want to copy and <destination>
is the path to the new folder where the contents will be copied. If you omit the <destination>
argument, Emptycopy will create a new folder with the same name and path as the source folder with an empty_
prefix.
Depth limit
You can limit the depth of the folder hierarchy that Emptycopy will copy by using the --depth
or -d
flag. For example, to copy only the top-level files and folders, you can run:
emptycopy --depth 1 <source> <destination>
Developers
If you want to contribute to Emptycopy, you can clone the repository and install the development dependencies using poetry. Remember to use the --with=dev
flag to install the development dependencies.
git clone
cd emptycopy
poetry install --with=dev # Installs dev dependencies.
poetry run emptycopy --help # Run the tool!
License
Emptycopy is licensed under the MIT License. See LICENSE for more information.
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
Built Distribution
File details
Details for the file emptycopy-0.1.0.tar.gz
.
File metadata
- Download URL: emptycopy-0.1.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa0e3197d8b41814fbc65491ccb8fbd1799fa11a045a67eae14c67a453be2584 |
|
MD5 | 4a668974b3d71fc4aac26bc14ab0fe3c |
|
BLAKE2b-256 | 107abc728811ae2ac0cb05ab4d4f70f052091f90b6a285715997c29e412552e2 |
File details
Details for the file emptycopy-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: emptycopy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15bdff8762550be755e04ac5584f2956c08f51545dd21055b86288d9b0f17fe1 |
|
MD5 | e9923db3dc5f7bc5ecae85ebd1297cf6 |
|
BLAKE2b-256 | 8e5c42d9d807e2619f71e1412ec6cf94aec857d3084a64debce08c706a41ea6e |