Skip to main content

Python script for sanitize files and directories names

Project description

Name Sanitizer

Motivation

This package arises from the need to clean file and directory names to be able to include them in our different projects. Sometimes these files are usually many and are at different levels of depth, for example, google sources. At other times we want to have an image repository but the names are very varied and / or contain special characters not supported for imports in some languages ... this package will help you with that.

Let's not forget the good android studio, surely you are already tired of manually renaming the files.

Install

pip install name_sanitizer

Simple usage

python -m ns

The package will work in the current path where the console is open. Remember that in Linux you can open the terminal contextually and in Windows, you can click on the breadcrumb in the folder, type cmd, press enter and the console will open in that path.

Options

--a => Replace the file or directory name with an anonymous one.

--r => Run the sanitizer recursively from the current directory.

--only_dir => Run the sanitizer for directories only

--only_file => Run the sanitizer for files only

--extensions => Defines the specific extensions where the sanitizer will act. (By default it includes directories)

Options usage

All the parameters except the extensions work as a flag, if you set it, it will work.

Example:

python -m ns --r --a

This will run the sanitizer recursively anonymizing files for child directories

Extensions:

You can define that the sanitizer only works on files with a certain extension. To do this, you must specify the extensions including the period, if there is more than one you must add them with a comma and without spaces.

Example:

python -m ns --extension=.ttf,.mp3 --r --only_file

This will run the sanitizer recursively only for files with the extension .ttf and .mp3 without renaming the directories.

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

name_sanitizer-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file name_sanitizer-1.0.0.tar.gz.

File metadata

  • Download URL: name_sanitizer-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for name_sanitizer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bdb53f8fb8ed53e68bec99032f5c18dbbffd8b7cb9427e269a30bd3af263f624
MD5 60f3c275f87e8064c8345efe726b2eaa
BLAKE2b-256 2ef8406876bdb63698daf3a66143b7d0d477a1dc0495e0b6db8422db5cce9757

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page