How to rename a file in Ruby? March 6, 2023 by Tarik What about simply: File.rename(f, folder_path + "https://stackoverflow.com/" + filename.capitalize + File.extname(f))