Quantcast
Channel: multiple file rename based on modification date - Ask Ubuntu
Viewing all articles
Browse latest Browse all 3

multiple file rename based on modification date

$
0
0

I have looked on the web on multiple sites but I can't seem to find a solution and the man page is not clear (I'm a beginner with the CLI). This is my problem: I have about 200 files in a directory, these files do not have an extensions and are named incorrectly.

For simplicity, imagine all files to be something like:

Delta ---   2.0K ---  01/01/1993
Gamma ---   2.1k ---  01/01/1991
Alfa  ---   2.2k ---  04/15/1992
Bravo ---   2.3k ---  04/10/1992

What I am trying to do is:

rename all files in this way 1, 2, 3,.., but such that the name is set according to the whole date (not just the year or the month), so the output should look something like

1 ---   2.1k ---  01/01/1991
2 ---   2.3k ---  04/10/1992
3 ---   2.2k ---  04/15/1992
4 ---   2.0k ---  01/01/1993

Also, I want to add an extension, eg .TXT so the final output can be:

1.txt ---   2.1k ---  01/01/1991
2.txt ---   2.3k ---  04/10/1992
3.txt ---   2.2k ---  04/15/1992
4.txt ---   2.0k ---  01/01/1993

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images