In PyCharm 3.4, I want to rename a file on the file tree that appears on the left of the IDE. If I right-click on a file, there is an option to delete it, but not to rename it. Similarly, there is no way of renaming it from the File or Edit menus. Is there a fundamental reason why PyCharm does not allow this from within the IDE, or have I missed the correct way of doing it?
rename() method allows you to rename files in Python. When used with the os. listdir() method, you can use os. rename() to rename all the files in a folder.
Files and Directories can be renamed by clicking on an already-selected item in the Project tool and editing the name in place. When Enter is pressed to complete the edit, the item will be renamed on disk.
Renaming files in PyCharm is simple. You simply select Refactor > Rename
when right-clicking on a file in the tree.
This will open a popup where you can type in the new filename. There are additional options when renaming, such as searching for references and in comments, strings, etc.
NOTE: While PyCharm is indexing files, the option is unavailable. Once indexing is finished (can take a while), it becomes available again (thanks @Eric_Sven_Puudist).
You can just choose the file and hit shift+F6
rename it then hit refactor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With