Skip to main content

pyfilemv

This small python package provides an extension to the normal unix mv command.

In addition to simply renaming a file or directory, pymv also searches through user-defined directories and asks the user if he or she wants to update any reference to the file that was renamed. Thus, you do not have to manually update all scripts or documents that reference that file. For a showcase of the package, see the Demonstration below.

Installation

pymv can simply be installed via PyPI .

pip install pyfilemv

Usage

Use pymv just like you would use mv, i.e. specify the file or directory which you want to rename as well as the new name as positional arguments. In addition you have to set a root directory using the -r flag.

pymv will then search through files and subdirectories that are part of the root directory. Only files that have a specific file extension (by default: R, Rmd, RMD, txt, py, ipynb, md, pl, cpp or java) will be evaulated.

You can extend the list of extensions, either by adding file extensions with the -e flag, or by creating a file .pyfilemv file in your home directory, where each line corresponds to one file extension.

You can also set the -a flag, if you only want to search and replace absolute paths. This might be helpful if you get to many 'false positive' hits.

If pymv finds a match in any of the files, it shows you the old line and how the new line would look like if you want to update the file. You can confirm that you want to do the replacement by typing y.

showcase_img


You can get help by running pymv -h

usage: pymv [-h] [-r ROOT] [-e EXTENSION [EXTENSION ...]] [-a] source destination

positional arguments:
  source                Source file.
  destination           Destination of the source file after the move.

optional arguments:
  -h, --help            show this help message and exit
  -r ROOT, --root ROOT  Specify the absolute path to a directory. All files that are part of that directory (and also subdirectories) are checked if
                        they contain the file you want to move.
  -e EXTENSION [EXTENSION ...], --extension EXTENSION [EXTENSION ...]
                        Specify file extensions which should be included in the search. Should look like this: -e ext1 ext2 ext3. By default, the
                        program searches in the following files: R, Rmd, RMD, txt, py, ipynb, md, pl, cpp, and java
  -a, --absolute        If you set this flag, the program will search for the absolute filepath.

Demo

Below is a small demo to showcase the function of the package. Here, we use it to rename a results object and show that the documentation that we wrote for this object, was automatically updated.

pymv_showcase

Metadata

Release files for pyfilemv 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfilemv 1.0.2
File Size Uploaded Provenance
pyfilemv-1.0.2.tar.gz 7.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfilemv 1.0.2
File Interpreter ABI Platform
pyfilemv-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / pyfilemv-1.0.2.tar.gz

Download URL pyfilemv-1.0.2.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3943e94896600cfd37ee833dcaccc9d81b22f2083df0b7defb006d48d80eaf00
BLAKE2b-256 checksum
How to use checksums
63855caa92bc79de29a2efa09e59e1d0f7b3ece647c8f75f6af5aef745a01b1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / pyfilemv-1.0.2-py3-none-any.whl

Download URL pyfilemv-1.0.2-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e0208015f9b7516b854d74bdc5b67a0de918460b55c8f1d4bea9e411ee96ea5
BLAKE2b-256 checksum
How to use checksums
c2a964fced035d5f22e6c98ffca33f04f1160206dfaabb56b0dce7f2dccfa6e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Security for pyfilemv 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page