From 97a6628a4639ca978a5ad4f1d699cebdcdc1991c Mon Sep 17 00:00:00 2001 From: Wei Shen Date: Fri, 5 May 2017 09:55:15 +0800 Subject: [PATCH] add examples --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index 8d037e4..e226713 100755 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ - [Installation](#installation) - [Usage](#usage) - [Examples](#examples) +- [Real-world examples](#real-world-examples) - [Contact](#contact) - [License](#license) @@ -281,6 +282,49 @@ Take a directory for example: [INFO] checking: [ ok ] 'b.jpg' -> 'c.jpg' [INFO] 2 path(s) to be renamed +## Real-world examples + +1. Renaming PDF files for compatibility (moving from `EXT4` to `NTFS` file system): + + 1. Original files: + + $ tree -Q + . + ├── "0000 Test.pdf" + ├── "2016 SeqKit _ A Cross-Platform and Ultrafast Toolkit for FASTA\342\201\204Q File Manipulation .pdf" + ├── "metagenomics" + │   ├── "2017 16S rRNA gene sequencing and healthy reference ranges for 28 clinically relevant microbial taxa from the human gut microbiome .pdf" + │   ├── "2017 De novo assembly of viral quasispecies using overlap graphs .pdf" + │   └── "2017 Tracking microbial colonization in fecal microbiota transplantation experiments via genome-resolved metagenomics .pdf" + ├── "test2222222222222222222211111111122222222222222222233333333.pdf" + └── "test.pdf" + + + 1. Removing "\n" + + $ brename -p "\n" -r " " -R + + 1. Replacing ":" with "_" + + $ brename -p ":" -r " _" -R + + 1. Shortening file names (prefering spliting with space) + + $ brename -R -f .pdf -i -p "^(.{30,50})[ \.].*.pdf" -r "\$1.pdf" -d + + 1. Result: + + $ tree -Q + . + ├── "0000 Test.pdf" + ├── "2016 SeqKit _ A Cross-Platform and Ultrafast.pdf" + ├── "metagenomics" + │   ├── "2017 16S rRNA gene sequencing and healthy.pdf" + │   ├── "2017 De novo assembly of viral quasispecies using.pdf" + │   └── "2017 Tracking microbial colonization in fecal.pdf" + ├── "test2222222222222222222211111111122222222222222222233333333.pdf" + └── "test.pdf" + ## Contact [Create an issue](https://github.com/shenwei356/brename/issues) to report bugs,