skip to navigation
skip to content

Not Logged In

namemod 0.1.1

A console tool for renaming files or folders.

Introduction

Once in a lifetime of a computer user is the need to rename multiple folders or files. Normally, the user will try to find all the locations of the folders or files to be renamed one by one starting from a starting folder (i.e. target folder). Some sample use cases that multiple renaming is done by the user are the following:

  • Copied a bunch of template folders and files and then renamed them accordingly.
  • Downloaded a bunch of episode of a TV series and the user has his/her own file naming convention.
  • A java developer is duplicating a big working package where the source files have embedded acronyms where he needs to rename those with a new the acronym.

Without a simple tool, these use cases are very time consuming to accomplish. This is the motivation that made this simple Name Modifier project to exist.

The Package

Name Modifier has three packages for different OS:

Package Description
namemod-<version>.zip Contains the Python source codes and documents packaged for Windows and Python 3.4 is required.
namemod-<version>.tar.gz Contains the Python source codes and documents packaged for Linux and Python 3.4 is required.
namemod-<version>.win-bin.zip Contains binary for Windows which doesn’t need Python to be installed

These packages are normally downloadable in addresses below:

https://pypi.python.org/pypi/namemod

and

https://sourceforge.net/projects/namemodifier/files

If the user had Python 3.4 installed, he/she doesn’t necessary needs to download this binary. The user can just use the pip module (see Installing the module using pip) for installation.

Installing the Package for Windows

The installation is as easy as downloading the namemod-<version>.win-bin.zip package and extracting it to wherever directory the user needs it to be. Moreover, it is recommended to include the installation directory to the users PATH environment variable.

Installing the module using pip

If the user had Python 3.4 installed, he/she can just use the pip module by running the command in Command 1.

Command 1. Using pip module for installation

C:\>python -m pip install namemod

Using the namemod command

Name Modifier can be used as easy as the other command line (e.g. dir) known to the user. The main command in this package is namemod. This command has many arguments that the user can opt to. If the user opted to install namemod using pip module (see Installing the module using pip), all the commands in the following sections can be carried out by using python with the following format found in Command 2:

Command 2. Using namemod with python

python -m namemod [optional arguments] <folder> <old_name_segment> <new_name_segment>

The -h or –help argument

Normally the first thing to do is to know how to use the command. This can be accomplished quickly by the -h or –help argument. For example, execute the command found in Command 3.

Command 3. Using -h argument

python -m namemod –h

The output would be the one shown in Listing 1.

Listing 1. -h argument output

usage: namemod [-h] [-f] [-F] [-i] [-I] [-m {text,regex}] [-n] [-R]
               [-xr regex] [-xt text] [-Xr regex] [-Xt text] [-v]
               folder old_name_segment new_name_segment

Simplifying multiple files or folders renames.

positional arguments:
  folder                Specifies the target folder to process.
  old_name_segment      Old name segment to be renamed.
  new_name_segment      New name segment.

optional arguments:
  -h, --help            show this help message and exit
  -f, --file-only       Process only files.
  -F, --folder-only     Process only folders.
  -i, --interactive     Ask confirmation before renaming.
  -I, --include-target-folder
                        Include the target folder in renaming.
  -m {text,regex}, --mode {text,regex}
                        Default: text
  -n, --noop            Inhibit the actual renamig but display the intended
                        outcome.
  -R, --recursive       Recursive
  -xr regex, --exclude-file-regex regex
                        Exclude files by regex.
  -xt text, --exclude-file-text text
                        Exclude files by exact text match.
  -Xr regex, --exclude-folder-regex regex
                        Exclude folders by regex.
  -Xt text, --exclude-folder-text text
                        Exclude folders by exact text match.
  -v, --version         show program's version number and exit

For more information about the usage, please download the user guide from https://sourceforge.net/projects/namemodifier/files

 
File Type Py Version Uploaded on Size
namemod-0.1.1.tar.gz (md5) Source 2014-07-04 671KB
namemod-0.1.1.zip (md5) Source 2014-07-04 677KB
  • Downloads (All Versions):
  • 3 downloads in the last day
  • 33 downloads in the last week
  • 170 downloads in the last month