Sublime Text: How do I rename the Directory in which I'm editing? - sublimetext3

I opened my folder called 'Tsunami++' in sublime text and I want to be able to rename it without having to close sublime text, open file explorer, find the folder, rename it, and open sublime again.
When I right-click the folder and select the rename option, type a new name, and hit enter, I get a quick 5 second message at the bottom that says
Unable to rename: [WinError 5] Access is denied: 'C:\\Users\\ramal\\Desktop\\Tsunami++' -> 'C:\\Users\\ramal\\Desktop\\Tsunami-plus-plus'
It says access is denied, shows the path to the directory, and what the path would be with the new name
I checked if the name was valid, and it was.
I checked if there was already a folder in my Desktop folder called Tsunami-plus-plus, and there wasn't, so it's not a matter of name validity or name collisions
My end goal is to be able to change the name of my current working directory within Sublime Text. How do I do this? What do I do to fix this error?

close Sublime Text
edit ~/Library/Application Support/Sublime Text/Local/Session.sublime_session by changing dir to dir2 (making sure you avoid errors there; do this at your own risk)
rename dir to dir2
re-open Sublime Text

Related

Can’t open a file whose directory’s name starting with #

I am using gvim on Windows10.
I use gvim as a default text editor on my PC.
When I double click and open a .txt file which is in a directory starting with “#”
For example:
C:first/second/#third/text.txt
Then gvim opens up and throws E344.
It seems accessing a wrong directory:
C:first/second#third/text.txt
How can I avoid this error without changing the name of the directory?

Moves files from directory by reading file names from a text file

I want a script that is able to read the content of a text file which contains folder names and moves the folders from their directory to a specific folder. Here is my script:
#!/bin/bash
for i in $(cat /folder/collected/folders.txt)
do
mv /fromfilelocation/$i /folder/Collected/
done
This script is partly working as it copies only the last folder in the text file, as for the other folders it gives the error "not possible: data or directory not found" But the folder is there and according to the error the folder directory is correctly displayed.
The names do not have special characters or white spaces and if either way full directory or only folder name in the text file it is the same error.
The error that is displayed is cannot find file or directory but it display the correct directory to the folder with a '$'\r'. example /fromfilelocation/foldername'$'\r.
This is error due to line feed characters.. do dos2unix on the file with directory names then run the script again. there is nothing wrong with script

renaming files with strange unicode names

Recently I downloaded some files from a website, but their names contain strange unicode characters, which my console doesn't show them properly. Now I want to rename these files to be able to use these files, but I get the following error:
mv: cannot stat`FILENAME': No such file or directory
But I am sure that these files exist.
I wonder how I can rename these files, properly.
Any ideas?
Using globbing characters (like ? or *): mv *some-typeable-and-unique-substring* ...
Using the tab-completion of your favourite shell: your start typing mv, then the beginning of the filename, then you press TAB, and then you can enter the second parameter.
If there are other files in that directory, you might have to move them to another directory to be able to use the tab-completion or the wildcards.

how to make a file editable in linux without becoming root

i am working with files placed in directory /etc/asterisk using vim editor, every time i have to do some editing i have to go to terminal to become root and opens file in vim editor and performs edition,but if i do it by directly opening the file from such directory(/etc/asterisk) in gedit and perform edition in the file but it doesn't show the save option if save as option is selected message becomes "you need to become root for such operation." is there any way to open these files(placed in /etc/asterisk) directly from gedit and save the changes without going into terminal
You can always do sudo gedit from the terminal to launch gedit as root to edit the files.

Deleting a shortcut of a folder which is in $windir

My requirement is to delete a shortcut to a folder. The folder named test is in $windir. The shortcut to that folder is on the desktop. My nsis script should delete that shortcut. What is the script line to do so?
The name of the shortcuts target does not matter, a shortcut is just a file with a hidden .lnk extension.
Delete "$desktop\nameofyourshortcut.lnk"

Resources