Last active
May 2, 2022 15:09
-
-
Save ssbozy/4d089f9462574c2fe026a90ad8d1d3a9 to your computer and use it in GitHub Desktop.
Renaming files using basename command.
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 | |
for file in *.md.html | |
do | |
mv "$file" "$(basename $file .md.html).html" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While using pandoc command in a script in a loop, I found that the html files generated from markdown filename extension usually append
html
after filename. An example can be something as follows. Using filenametest.md
, the generated html file istest.md.html
. Since renaming files individually is a pain, I created the above script to fix that. I saw people use regex based renaming as well but I like this method.