Last active
July 3, 2022 02:29
-
-
Save luckylittle/2395ac9066cfb6754d961914e8d5ea98 to your computer and use it in GitHub Desktop.
Creates folders based on filenames (without extensions) in the current directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ls -1 *.mkv | rev | cut -d '.' -f2- | rev | xargs mkdir -v | |
for i in $(ls -1 *.mkv); do mv -v ${i} ${i%.mkv}; done | |
# Before: | |
# [lmaly@localhost The_Man_in_the_High_Castle]$ ls -1 *.mkv | |
# The.Man.in.the.High.Castle.S01E01.720p.WEBRip.x264-BATV.mkv | |
# The.Man.In.The.High.Castle.S01E02.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E03.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E04.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E05.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E06.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E07.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E08.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E09.720p.WEBRip.x264-SERIOUSLY.mkv | |
# The.Man.In.The.High.Castle.S01E10.720p.WEBRip.x264-SERIOUSLY.mkv | |
# After: | |
# [lmaly@localhost The_Man_in_the_High_Castle]$ ls -1 -d */ | |
# The.Man.in.the.High.Castle.S01E01.720p.WEBRip.x264-BATV/ | |
# The.Man.In.The.High.Castle.S01E02.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E03.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E04.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E05.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E06.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E07.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E08.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E09.720p.WEBRip.x264-SERIOUSLY/ | |
# The.Man.In.The.High.Castle.S01E10.720p.WEBRip.x264-SERIOUSLY/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment