Skip to main content

A tool to solve daily work.

Project description

workutils

A tool to solve daily work including file encoding conversion, keyword search, and file type analysis.

Installation

You can install, upgrade, or uninstall workutils with these commands:

$ pip install workutils
$ pip install --upgrade workutils
$ pip uninstall workutils

Help

$ workutils -h
usage: workutils [-h] [-s SUFFIX] [-k KEYWORDS] [-a] [-o OUTPUT] directory

A tool for daily work

positional arguments:
  directory             Folder path to analyze

options:
  -h, --help            show this help message and exit
  -s SUFFIX, --suffix SUFFIX
                        File suffix to analyze
  -k KEYWORDS, --keywords KEYWORDS
                        Count Keywords in all files, such as 'key word1','key word2'
  -a, --all-files       Traverse all files, including hidden files
  -o OUTPUT, --output OUTPUT
                        File path to save the result
  -d, --delete          Delete specified files after confirmation

Example

Select the folder path to analyze

$ workutils ../
E:\workutils\a.txt
E:\workutils\LICENSE
E:\workutils\README.md
E:\workutils\workutils\workutils.py
E:\workutils\workutils\__init__.py
========================================
Suffix    Counts
----------------------------------------
.txt      1
          1
.md       1
.py       2
----------------------------------------
Total     5
========================================
$

Select the folder path and specify the files with a certain suffix to analyze.

$ workutils ../ -s py
E:\workutils\workutils\workutils.py
E:\workutils\workutils\__init__.py
========================================
Suffix    Counts
----------------------------------------
.py       2
----------------------------------------
Total     2
========================================
$ 

Traverse all files, including hidden files

$ workutils ../ -a   
E:\workutils\a.txt
E:\workutils\LICENSE
E:\workutils\README.md
E:\workutils\.git\config
...
E:\workutils\.git\refs\remotes\origin\HEAD
E:\workutils\workutils\workutils.py
E:\workutils\workutils\__init__.py
========================================
Suffix    Counts
----------------------------------------
.txt      1
          15
.md       1
.sample   13
.idx      1
.pack     1
.py       2
----------------------------------------
Total     34
========================================
PS $ 

Input result file path to save the result

$ workutils ../ -s py -o result.txt
E:\workutils\workutils\workutils.py
E:\workutils\workutils\__init__.py
========================================
Suffix    Counts
----------------------------------------
.py       2
----------------------------------------
Total     2
========================================
The result has been saved to the E:\workutils\workutils\result.txt file.
$ 

Find keywords and count occurrences in all files

$ workutils ./ -s log -k 'AS0100504GN_2' -o a.txt
E:\workutils\workutils\1111.log
E:\workutils\workutils\a\a.log
E:\workutils\workutils\b\test.log
E:\workutils\workutils\c\c.log
==================================================
Suffix              Counts
--------------------------------------------------
.log                4
--------------------------------------------------
Total               4
==================================================


100%|███████████████████████████████████████████████| 4/4 [00:00<00:00,  3.76it/s]
==================================================
Keyword             Matches             File Name
--------------------------------------------------
AS0100504GN_2       32                  1111.log
--------------------------------------------------
==================================================

The result has been saved to the E:\workutils\workutils\a.txt file.
$ 

Deleted files

$ workutils ../ -s py -d
E:\workutils\workutils\workutils.py
E:\workutils\workutils\__init__.py
========================================
Suffix    Counts
----------------------------------------
.py       2
----------------------------------------
Total     2
========================================


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        Are you sure you want to delete these files?
                Type 'yes' to confirm: yes
Deleted file: E:\workutils\workutils\workutils.py
Deleted file: E:\workutils\workutils\__init__.py
$

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

workutils-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

workutils-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file workutils-0.1.0.tar.gz.

File metadata

  • Download URL: workutils-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for workutils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c7e4665e5fb0d5c82e0f68a06b59596004477b2df739f5557c622ddf76341a0
MD5 ff4b202452305327a53a3b895e7258fe
BLAKE2b-256 b11559db26ff416b49b3b2b1ee0913188159f1e013a98165d1a1349bbfbdb992

See more details on using hashes here.

File details

Details for the file workutils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: workutils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for workutils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75ca2411a1320161f56c79a76b7a9355ce7d48f6e8208a168b83ac704985a81f
MD5 7e530d5ea2d5d53c4fda82bb3629aa6f
BLAKE2b-256 4c94346546958a76e91f4fdc1c3cc68fd53dd4b0728a7613374727af07a8420e

See more details on using hashes here.

Supported by

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