"Create new empty file" function
Moderators: Hacker, petermad, Stefan2, white
"Create new empty file" function
TC has a lot of integrated functions but strangely enough, it doesn't have a very simple function for creating a new empty file.
At the moment, if I want to create a new empty file, I have to use an external application, like Notepad or Notepad++. Problem with this is that, when I want to save newly created file, I have to manually browse for folder where I want to save that file (using Save file dialog from the external application). However, if there was a function similar to MkDir that prompts for file name and creates an empty file with given name in current folder, then, if I want to edit that file, I'd simply use F4 to open my preferred editor.
This could be very useful, for example, for web developers who want to quickly create a new HTML or PHP file without having to go through browsing for the same folder that is already open in TC.
I'd like to hear what others think about this.
At the moment, if I want to create a new empty file, I have to use an external application, like Notepad or Notepad++. Problem with this is that, when I want to save newly created file, I have to manually browse for folder where I want to save that file (using Save file dialog from the external application). However, if there was a function similar to MkDir that prompts for file name and creates an empty file with given name in current folder, then, if I want to edit that file, I'd simply use F4 to open my preferred editor.
This could be very useful, for example, for web developers who want to quickly create a new HTML or PHP file without having to go through browsing for the same folder that is already open in TC.
I'd like to hear what others think about this.
Shift+F4 is much better than what I do: "copy nul filename" at the command line. But it also opens a text editor, for which I have no need. I wonder if there is an alternative.
Last edited by sorcar on 2012-02-22, 20:37 UTC, edited 1 time in total.
You may create a user-command (with shortcut) or a buttonbar button that will ask for a filename and open it in your favorite editor (if it can create files; notepad.exe is used just for example) using my AskParam:
Code: Select all
Command: AskParam.exe
Parameters: /c"Edit new file" /t"Untitled.txt" /p"Enter filename:" "notepad.exe" "%P\%%1"
I use this
2umbra
You are right. I was looking for an easier way to create 0-length files. I now do Shift+F4, after MVV's brief and beautiful suggestion, or call a batch file from a button which creates through "copy nul filename".
2damjang
Thanks for the link, icfu explains there the need for such files. But I am not sure I found a strightforward way yet.
You are right. I was looking for an easier way to create 0-length files. I now do Shift+F4, after MVV's brief and beautiful suggestion, or call a batch file from a button which creates through "copy nul filename".
2damjang
Thanks for the link, icfu explains there the need for such files. But I am not sure I found a strightforward way yet.
You can create user command like
Whenever you call it, TC will show empty parameter prompt window where you can type filename to create. Just don't forget about quotes around filenames with spaces.
Code: Select all
Command: cmd /c copy nul
Parameters:?
Great and simply idea!G-nom wrote:You can create user command likeWhenever you call it, TC will show empty parameter prompt window where you can type filename to create. Just don't forget about quotes around filenames with spaces.Code: Select all
Command: cmd /c copy nul Parameters:?
For those who are lazy like me and haven't intention to type the double quotes around filenames with spaces:
1- Create an empty bat file with this string inside: copy nul "%*"
Example: C:\totalcmd\NewFile.bat
2- Copy the path of the bat file that you have created before
3- Then go in Total Commander configuration and click on Misc.
4- Choose an Hotkey, for example F11 that isn't used, then click on magnifier
5- In Category menu choose usercmd.ini section, press on "New..." and type the command name.
Example: em_NewFile
6- In the field "Command" paste the path of the bat file
In the field "Parameters" write a question mark (?)
In the field "Icon file" choose an icon that you want, for example the
standard Windows icons that are situated in: C:\Windows\System32\shell32.dll
7- Finally confirm the new hotkey
You can now create a new empty file by pressing F11 key in the current directory.
Image: http://oi46.tinypic.com/e88j6w.jpg
Suggestion: You can also create a button in the button bar for the NewFile command and launch it by a mouse clicking.
Last edited by krypton on 2013-02-17, 18:48 UTC, edited 1 time in total.