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.2.tar.gz
.
File metadata
- Download URL: emptycopy-0.1.2.tar.gz
- Upload date:
- Size: 15.0 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 | ca828b92b18639eb5a1622a77b78355057b0ddff35d8eb6cf6c7b63213a8960c |
|
MD5 | a51f043f3f84b0bef962f0048655ffcc |
|
BLAKE2b-256 | 0b6bd9565208f59b25dfb4b03a457424c07cd19302acf39ec4e427ca5678809b |
File details
Details for the file emptycopy-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: emptycopy-0.1.2-py3-none-any.whl
- Upload date:
- Size: 15.8 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 | a1ff477cce7f31da0fedfab28b6a4795691c151f3283f3960dc4579b5cba7947 |
|
MD5 | ea290a00b05bd4255d9d474362e55f57 |
|
BLAKE2b-256 | 1df52e57009918b8369da55255d8a19df06cfc6d848cb160b3db42c441836ea1 |