Rename multiple files in the folder with Julia

You can get a list of file names using readdir. From there you can iterate over all the files and call mv to rename them.


files = readdir()
txt_files = filter(endswith(".txt"),files)
for (i,file) in enumerate(txt_files)
   mv(file,"$(i).txt")
end
10 Likes