Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Created July 25, 2022 06:21
Show Gist options
  • Save xbalaji/0b6701f439b8a8f22795de747512ae1c to your computer and use it in GitHub Desktop.
Save xbalaji/0b6701f439b8a8f22795de747512ae1c to your computer and use it in GitHub Desktop.
create-dir-rename-find.sh
#! /usr/bin/bash
mkdir -p Torrent/Self\ help_Pack\ {00..04}/{,{English,German}\ Author{01..3}}
touch Torrent/Self\ help_Pack\ {00..04}/{,{English,German}\ Author{01..3}}/book.pdf
mkdir -p Torrent/python\ for_datascience
touch Torrent/python\ for_datascience/python\ for_datascience.pdf
mkdir -p Torrent/yoga_the_art-of-science
touch Torrent/yoga_the_art-of-science/yoga_the_art-of-science-files{01..03}.pdf
mkdir -p Torrent/python-gui_programming\ with-tinker\ {2016..2018}
touch Torrent/python-gui_programming\ with-tinker\ {2016..2018}/python-gui-programming-with-tinker.pdf
mkdir -p Torrent/yoga\ for_women\ \({2020..2022}\)/lessons{01..03}
touch Torrent/yoga\ for_women\ \({2020..2022}\)/lessons{01..03}/{first,second,third}.pdf
find . -depth -type d -execdir rename 's/ 20[0-9][0-9]//g;y/)( _-/-/;s/(\w+)/\u\L$1/g;s/-//g' {} \+
# ^^^^^^^^^^^^^^ ^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment