|| == Renaming files or folders ==
In x2, you have the following options for renaming items:
- Rename items individually (the extension is left untouched)
- Change the extension of the file
- Rename items in bulk
The following sections describe each method.
|| === Individual renaming ===
To rename a file/folder individually, select it and press F2 (you can also select the File | Rename... menu). x2 switches to edit mode, and opens the fileâ€™s name in an edit field.
In this edit field, a â€œ|â€ cursor blinks at the end, indicating where your new string will appear. Note that the entire name of the item is highlighted by default.
You have the following choices:
- To rename the file totally, just type the new name. You donâ€™t have to delete the older name first: The highlighted text is automatically replaced by the new text.
- To attach a suffix string to the name, press the RightArrow key (or the END key). The highlight around the name is removed, but the blinking cursor remains at the end of the name. Start typing the suffix string.
- To attach a string to the beginning of the existing name, press the Home key. The highlight around the name is removed, and the blinking cursor jumps to the beginning of the existing name. Start typing the prefix string.
- To move the blinking cursor to any other part of the name, use any combination of these shortcuts: RightArrow, LeftArrow, CTRL+RightArrow, CTRL+LeftArrow, Home and End. You can delete some letters at this place using Del and BKSP and type a new string.
- To delete a part of the name, you will need to highlight it first, and then delete this highlighted part, with Del or BKSP. Or simply type a new string to replace the highlighted portion of the name.
|| x2 provides several mechanisms for easy highlighting: Place the cursor at the desired place in the name, and then use the following shortcuts to extend the highlight till a specific part of the name:
|| How it extends the highlight
|| Letter-by-letter, towards the beginning of the name
|| Word-by-word, towards the beginning of the name
|| Till the beginning of the name
|| Letter-by-letter, towards the end of the name
|| Word-by-word, towards the end of the name
|| Till the end of the name
|| The renaming is not over till you press Enter. This is your last chance to abort the renaming (x2 cannot undo a renamed file):
- To accept the changed name, press Enter.
- To cancel the renaming, press ESC. (If you switch to another application before pressing Enter, x2 will cancel the renaming.
|| Caution: Sometimes, another application pops up a dialog window, and steals the focus. This effectively terminates the renaming. When this happens, switch back to x2 and check whether the item was renamed properly.
|| === Changing extension of a file ===
[[Image:]]Highlight the file and press CTRL+F2. A dialog box pops up. Change the extension (you can edit the base name, too) and press OK.
Note that not all type changes make sense, e.g. you can't change a txt file to exe and expect it to be transformed into an executable! Still changing extensions can be useful for various text file types.
Here are some typical applications:
- If you have a separate folder for installing utilities, you may want to change the installation path. However, many WinZip self-extracting executables do not allow you to select the installation path. To overcome this problem, simply change the file extension from "exe" to "zip". After this, if you d-click on it, the file will open rather than execute. Then you can extract the files and place them where you want.
- If you have a PowerPoint presentation (pps) file, you can edit it after changing its extension to â€œpptâ€.
- Some files downloaded from the Internet do not open (with Acrobat Reader or other relevant application). Sometimes this is because the file is corrupt, but often this is because the file was given a wrong extension (and therefore a wrong application is trying to open it). In this latter case, it is possible to recover the file by just changing its extension to the correct type. Whenever you get such errors, check out the file with [#5.1.1.How different parts of the screen work|outline QuickViewer] or a text editor (select the file and press F3). The type of the file is usually identified near the top of the file (in a portion called file header). Although there will be junk (unreadable) characters in this part, you may be able to determine what type of file it is. (To avoid a sharing violation, first make sure that the editor is closed and only then change the extension.)
- If you are not able to find the fileâ€™s true type from its header, then you can run TrID on it (see [#_Applications_that_extend chapter 8]). Then change its extension accordingly.
- Security professionals have to handle virus and other malicious software, To prevent the software from accidentally running on their machines, they can mask the original extension of the file, by adding a dummy extension that cannot be executed. (for example, if the file virus.exe is renamed as virus.exe.xx, it cannot be executed by mistake).
Later, to run the software, just strip off this dummy extension to recover the original file, which can be executed.
|| === Mass renaming ===
You can rename multiple items simultaneously with a single command. This command allows you to change both the base name and/or extensions.
Select multiple items and follow these steps:
- Press F2 or use File | Mass Rename... command. The Mass Rename wizard pops up (see the figure below).
Note that the shortcut F2 is common for renaming individual items and also for renaming a selection. If you have selected more than one items, x2 automatically switches to mass renaming mode.
|| # Using special â€œtokensâ€, compose a template for the new names in the Target Name Template combo.
- The Special tokens pull down menu provides you with some special tokens. Whatever option you select here gets added to the string already composed in the Target Name Template combo.
- If you need help about tokens, press the $-Token help button.
- At any time you can press Cancel button to abort the command.
- Press the Preview button to see a preview of the changes in the names using the current template.
- If you are not satisfied, change the template and repeat step 2.
- When you are satisfied, press the Rename button.
Refer to [#App9B Appendix 9B] for a full list of tokens and their typical uses.
Using mass-renaming for changing the extension of files
In the previous section, we saw that the extensions of malicious software can be changed to disarm them. If you have many such files, you can use the mass rename command, as follows:
To mask the original extensions:
- Select multiple files and press F2.
- In the mass rename dialog box, enter $N.xx and press OK.
This command adds xx as a dummy extension to the filename. (The $N token represents the original name+extension of the file, and the .xx is a literal string, which is added to each file name.)
For example, the file virus.exe becomes virus.exe.xx. This new file will not be executed like a normal exe file.
[[Image:]]Tip: The xx extension does not imply anything. Instead, you can devise your own extensions, where each extension indicates some property of the file. For example, xx1 can mean â€œcriticalâ€, xx2 can mean â€œmajorâ€, xx3 can mean â€œmoderateâ€, etc.
To strip the dummy extensions:
- Select multiple files having dummy extensions and press F2.
- In the mass rename dialog box, enter $B and press OK.
This command strips off the dummy extension. (The $B token actually extracts the base name of the file. But in this case, the â€œbase nameâ€ is actually the name+extension of the original file!)
For example, virus.exe.xx becomes virus.exe. Now this file can be executed.