How to rename the file in Sublime Text

Rename files quickly & easily in Sublime Text with this simple tutorial: step-by-step guide with an example.

Renaming a File in Sublime Text

Sublime Text is a powerful text editor which makes it easy to rename a file. To rename a file using Sublime Text, you simply need to open the file in the editor and then select the name of the file in the tab at the top. This will bring up a text box where you can type in the new file name. Once you have entered the new name, you can press Enter or click the “Save” button to save the file with its new name.

If you have multiple files open in Sublime Text, it is possible to rename all of them at once. To do this, you first need to select all the files you want to rename by holding down the Ctrl key and clicking on each file. Once all the files are selected, you can right-click on any one of them and select “Rename” from the context menu. This will bring up a text box where you can type in the new name for all the selected files. Once you have entered the new name, press Enter or click the “Save” button to save all the files with their new names.


// Rename a file with a new name
var newName = "myNewFileName.txt";
FileSystem.rename("oldName.txt", newName);

// Rename multiple files with a new name
var newName = "myNewFileName.txt";
var files = FileSystem.getFiles("*.txt");
files.forEach(function(file) {
  FileSystem.rename(file, newName);
});

Renaming files in Sublime Text is a simple process that can be done in a few clicks. Whether you are renaming a single file or multiple files, the same process applies. After entering the new name, you can save the file(s) and they will be renamed with the new name you specified.

Answers (0)