Command-line utility to view and modify 8.3-style short file names on Windows
Project description
ShortName
Python command-line utility to view and modify 8.3-style short file names on Windows, with no dependencies.
Table of Contents
What Is This?
Files with sufficiently long names on Windows may have a second, shorter, hidden name called an 8.3 alias. They are usually automatically generated, but can be set manually as well. This tool allows you to view and change those aliases.
For example, you may have a file named some_long_file_name.txt
.
With ShortName, you can run:
python ShortName.py set some_long_file_name.txt short.txt
And now some_long_file_name.txt
has the hidden alias short.txt
.
If the full path to some_long_file_name.txt
is C:\Files\some_long_file_name.txt
,
you can now refer to it almost everywhere as C:\Files\short.txt
as well;
notepad C:\Files\short.txt
will open the same file as notepad C:\Files\some_long_file_name.txt
.
Setup
You can run ShortName either as a single-file script ShortName.py
,
or install it to run it more easily from anywhere.
Regardless of the method, you first need to install Python 3 if you don't have it.
As a Script
No further installation is required, as it has no dependencies. You can use it immediately as a script, e.g.:
python ShortName.py get .\some_long_file_name.txt
Optional Installation
If you wish to install ShortName—for example, to invoke it from anywhere—you can run:
python -m pip install ShortName
To install ShortName via PyPI.
Alternatively, you can:
- Download the ShortName repository
- Unzip it
- Run
python -m pip install <path to unzipped directory>
Regardless of which of installation method you choose, you should then be able to invoke ShortName
from anywhere,
in either of the following two ways:
python -m ShortName get .\some_long_file_name.txt
, orShortName get .\some_long_file_name.txt
To uninstall it, run:
python -m pip uninstall ShortName
Usage
ShortName has two commands, get
and set
, to either view or modify the short name of a file, respectively.
You can also run python ShortName.py --help
for usage information.
View the short name of a file
The command to view the short name of a file is python ShortName.py get FILE
.
Example usage:
python ShortName.py get .\some_long_file_name.txt
Example output:
.\SOME_L~1.TXT
Note: If the output is the same as the input, either no short name exists, or the input was already a short name.
Tip: You can also view all files and their short names (if they exist) in
cmd
with the commanddir /x
.
Set the Short Name of a File
The command to modify the short name of a file is python ShortName.py set [-q] FILE SHORTNAME
.
There are strict naming requirements on 8.3-style short names. Notably, they require:
- True ASCII only, in the 7-bit range
- No spaces
- 1-8 characters (other than
.
) before the extension - (Optional) One
.
followed by 1-3 characters (other than.
) for the extension
If a requested short name is invalid, ShortName will report an error that the name could not be set.
Example usage:
python ShortName.py set .\some_long_file_name.txt short.txt
Example output:
Successfully set shortname of .\some_long_file_name.txt to "short.txt"
Note: You can silence the success message with the
-q
or--quiet
option.
License
ShortName is free and open-source software provided under the zlib license.
Project details
Release history Release notifications | RSS feed
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 ShortName-1.1.0.tar.gz
.
File metadata
- Download URL: ShortName-1.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 709332553b34f6ec0b0acb738e5a59ffe5576884b51b03147a42a8fe8d315a3b |
|
MD5 | e7d2b036b9ec5f1440b998be28471ff0 |
|
BLAKE2b-256 | d0ccea1ab477d2edd10e7e4a76895ffe6efa9beb64a27247426cd9660da4b82c |
File details
Details for the file ShortName-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: ShortName-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccb02b82a1d373a401f1ac1b6500c3b395e020a3849b5c40ad1caea85d182121 |
|
MD5 | e8e66b49e94bfbd5c5caac4e47dc92d9 |
|
BLAKE2b-256 | 9bc493192c6b75a24f68bef02125bec903dee9fbea16549ba7d50193b1a00203 |