0

If I have a directory, how do I add the number of the file to beginning of the filename? For example, the directory would look something like this:

file.txt
another_file.txt

And the expected output would be:

1_file.txt
2_another_file.txt

Is there a way to do this? I've seen this post, but I amn't sure how to change the prefix for each file (in this example, have it increase by one each time).

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
k-a-v
  • 202
  • 2
  • 9

0 Answers0