Renaming File Names That Contains Date
Itachi Uchiha

Itachi Uchiha @itachiuchiha

About: I'm a front-end developer. I'm living in Turkey. I started my professional career in 2016. I also interest in Backend, SQL technologies.

Location:
Turkey
Joined:
Nov 21, 2017

Renaming File Names That Contains Date

Publish Date: Oct 10 '20
9 0

Hi there. I have a lot of files contains date format in their name. I wanted to remove that dates from that files. I wrote the bash script belove. You can use this script. It works 🙂

My files was like that;

2020-10-08-example.md.

Btw, customize it for yourself.

#!/bin/bash

# description: Your files should be like that; 2020-10-08-example.md

for i in *.md
do
    mv $i $(echo $i | sed -E 's/([0-9]{4}-[0-9]{2}-[0-9]{2}-)//')
done
Enter fullscreen mode Exit fullscreen mode

What would your approach to this be? How would you solve it?

Comments 0 total

    Add comment