Skip to main content

cover_photo

Overview

License Issues codecov build PyPI Docs

bulk-mv is an interactive tool that does what the mv command does, but for mulitiple files, with the ability to do more like adding and deleting files as well.

Installation

pip install bulk-mv

Usage

When you run bmv <path>, a bulk-mv (bmv) file will open in a vim buffer, representing the file tree starting in the directory located at <path>.

Then, you can make your modifications in the vim buffer, and run :wq to perform the changes.

Suppose your directory file tree was this:

.
├── README.md
└── web
    ├── public
    │   └── photos
    │       └── logo.png
    └── static
        ├── javascript
        │   ├── auth.js
        │   └── main.js
        └── styles
            └── main.css

Then running bmv <path> will open up the following bmv file in a vim buffer:

[./] {
  README.md
  [web] {
    [public] {
      [photos] {
        logo.png
      }
    }
    [static] {
      [styles] {
        main.css
      }
      [javascript] {
        auth.js
        main.js
      }
    }
  }
}

Some Use Cases

Renaming multiple files

https://user-images.githubusercontent.com/18252779/229972782-6a5fcad5-a399-409e-b39a-a94f8f6136f9.mov

Moving multiple directories

https://user-images.githubusercontent.com/18252779/229972812-952d97f5-55ba-4407-bf0b-9ec14ce10fa2.mov

BMV Syntax

Here's how to use the only four operators in BMV (+, -, >, >>) to add, delete, rename, and move files and/or directories.

Creating new files/directories

You can add files or directories using the + operator.

Here's how to use it to add new files and directories

[./] {
  README.md
  [web] {
    [public] {
      [photos] {
        logo.png
      }
    }

    + [templates] {
      + [dashboard] {
        dashboard.html
        admin.html
      }

      index.html
      about.html
    }

    [static] {
      [styles] {
        main.css
        + dashboard.css
      }
      [javascript] {
        auth.js
        main.js
      }
    }
  }
}

Notice how you can add multiple nested directories. If you want to add a single file you need to type + new_file.txt in the directory block where you want it.

If you create a new directory with (also new) files inside of it, you don't need to use the + operator to add them. But for new nested directories, you do need to use the + operator.

Deleting files/directories

You can delete files or directories using the - operator.

You can delete entire directories or files like this:

[./] {
  README.md
  [web] {
    [public] {
      [photos] {
        logo.png
      }
    }
    [static] {
      - [styles] {
        main.css
      }
      [javascript] {
        - auth.js
        main.js
      }
    }
  }
}

Running this would delete the ./web/static/javascript/auth.js file as well as the ./web/static/styles/ folder (and of course everything in it).

Renaming files/directories

You can rename files or directories using the > operator.

[./] {
  README.md
  [web] {
    [public] {
      [photos > images] {
        logo.png
      }
    }
    [static] {
      [styles] {
        main.css
      }
      [javascript] {
        auth.js
        main.js > script.js
      }
    }
  }
}

Running this would rename the ./web/public/photos/ directory to ./web/public/images/, and rename ./web/static/javascript/main.js to ./web/static/javascript/script.js

Moving files/directories

You can move files or directories using the >> operator. Moving files to paths with non-existent directories will not be created automatically.

[./] {
  README.md >> ./web
  [web] {
    [public] {
      [photos >> ./web/static] {
        logo.png
      }
    }
    [static] {
      [styles] {
        main.css
      }
      [javascript] {
        auth.js
        main.js
      }
    }
  }
}

Running this would move ./README.md to ./web/README.md, and move ./web/public/photos/ to ./web/static/photos.

You currently have to specify the full path to the directory you want to move the file/directory to starting from root path of the file tree (in this case, it's ./).

Putting it all together.

Of course, you can mix and match these operations all in one go. Just note the order of operations to avoid making a mistake, like moving a file to a directory that you haven't created yet, for example.

Operations are given the following precedence:

  1. add
  2. delete
  3. rename (files first, then directories)
  4. move (files first, then directories)

Caveat

So far, bulk-mv only works on files/directories with POSIX Portable filenames/dirnames.

In the future version, I want bulk-mv to support any type of support filenames on Mac OS, Linux, and Windows.

Metadata

Release files for bulk-mv 0.1.5

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

Source distribution (sdist)

Source distribution for bulk-mv 0.1.5
File Size Uploaded Provenance Actions
bulk-mv-0.1.5.tar.gz 202.2 kB Without provenance Details for bulk-mv-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bulk-mv 0.1.5
File Interpreter ABI Platform Actions
bulk_mv-0.1.5-py3-none-any.whl Python 3 none any Details for bulk_mv-0.1.5-py3-none-any.whl

Total release size: 229.2 kB

Release files / bulk-mv-0.1.5.tar.gz

Download URL bulk-mv-0.1.5.tar.gz
Size 202.2 kB
Tags Source
SHA-256 checksum
How to use checksums
903eb873c3b908d528450c8d47628766df3d87e49ad4f927954872b6dca61c0a
BLAKE2b-256 checksum
How to use checksums
d2e543f919f0b2c190e655e27e7da78c45f4f36606aaaa65296d20e5fa69dfa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / bulk_mv-0.1.5-py3-none-any.whl

Download URL bulk_mv-0.1.5-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc54fb8227924ca2eec8ed890bfb3c868d7ad8d41f852b117eb6ebce00656ba0
BLAKE2b-256 checksum
How to use checksums
07cb162698504cad73465bbe59d3fa8d984a47ce6416f20557739967ef34de2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for bulk-mv 0.1.5

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