IT tutorials
 
Windows
 

Windows Vista : Working with Files and Folders (part 3) - More Ways to Rename Files, Delete In-Use Files

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
1/11/2013 11:17:39 AM

5. More Ways to Rename Files

Renaming files is just as common as copying or moving, but it can end up being a much more tedious task in Windows Explorer.

In its simplest form, Explorer's rename feature works like this: highlight a file, wait a fraction of a second to avoid double-clicking, then click the filename. When the text field appears, type a new name and then press Enter to rename the file. You can also right-click and select Rename, or highlight the object and press the F2 key.

Then, do it 39 more times to rename all 40 files.

5.1. Solution 1: Select multiple files in Explorer

If you press F2 when more than one file is selected in Windows Explorer, only one file—the active file—gets a text field for you to type in. Nothing will happen to the other selected files, at least not yet.

The active file is important, since its name is used as a template to rename the other selected files. If the file marked as active is not the one you want to use, hit Esc, and then hold the Ctrl key while clicking another file. If the new file was highlighted, it will become deselected—in this case, just Ctrl-click the file once more to reselect it. Then, press F2 again to show the text field.

Rename the active file as desired, and press Enter when you're done. The active file keeps its new name, and then Explorer assigns the same name—plus a number, in parenthesis—to all the other files. Table 1 shows what happens when you rename files this way.

Table 1. What happens when you try to rename multiple files in Explorer
Old filename New filename
My file.doc (the active file) The Penske File.rtf
Grandma.jpg The Penske File (1).jpg
Readme.1st The Penske File (2).1st
Purchases.mdb The Penske File (3).mdb
Chapter 2 (a folder) The Penske File (4)

Although Explorer doesn't show you a preview of your new filenames, you can undo a multiple rename operation as easily as a single rename operation by pressing Ctrl-Z once for each file that was renamed. Want to undo a single rename of 17 files? You'll need to press Ctrl-Z 17 times.

5.2. Solution 2: Use the Command Prompt

An alternative is to use the ren command, either directly from the Command Prompt (cmd.exe), or from a batch file or PowerShell script.

First, use the cd command, to change the working directory to the folder containing the files you wish to rename. For example, type:

cd c:\stuff

to change to the C:\stuff folder. If the folder name contains a space, enclose it in quotation marks, like this:

cd "c:\Progam Files\stuff"

Next, use the ren command to rename the file; the general syntax is:

rensource destination

where both source and destination can be any combination of permissible characters and wildcards. Two wildcards are allowed: an asterisk (*), which is used to match any number of characters, and a question mark (?), which is used to match only a single character. For example:


Rename a single file

ren oldfile.txt newfile.txt


Change the extension of all .txt files to .doc

ren *.txt *.doc


Rename the first part of a filename without changing the extension

ren document.* documentation.*


Remove the extensions of all files in the folder

ren *.* *.


Change the first letter of all files in a folder to "b"

ren *.* b*.*


Add a zero in front of numbered Chapter files (note the quotation marks)

ren "Chapter ??.wpd" "chapter0??.wpd"


Rename all files with an "s" in the fourth position so that a "t" appears there instead

ren ???s*.* ???t*.*


Truncate the filenames of all files in the folder so that only the first four characters are used

ren *.* ????.*

Now, using wildcards takes a bit of practice and patience. The more you do it, the better intuitive sense you'll have of how to phrase a rename operation. To make things simpler, try issuing several successive ren commands instead of trying to squeeze all your changes into a single step.

If a naming conflict occurs, the ren command never overwrites a file. For example, if you try to rename Lisa.txt to Bart.txt, and there's already another file called Bart.txt, ren just displays an error.

5.3. Solution 3: Use a third-party add-on

Got a lot of files to rename? Use Power Rename, part of Creative Element Power Tools (http://www.creativelement.com/powertools). To use the tool, open the Creative Element Power Tools Control Panel, turn on the Rename files with ease option, and click Accept.

Then, highlight any number of files to rename, right-click, and select Power Rename. Or, open the Power Rename utility (Figure 7) and drag-drop the files onto the window.

Figure 7. Power Rename makes it much easier to rename many files at once


Select the renaming criteria to your right. The first option, As Specified, allows you to type a file specification with wildcards, as described previously, but the real power lies in With Operation, and the operations that follow. For instance, you can insert text anywhere, remove text (crop), search and replace text, add numbering, and even fix numbered codes in files downloaded from the Web.

Turn on the Show what files will look like option to see a live preview of the filenames as you adjust the options. When you're done, click Accept to rename the files.

6. Delete In-Use Files

Sometimes Vista won't let you delete a file, which is stupid because it's your PC and you should be able to delete anything you want. So there.

Of course, there are times when Vista does know better than you, and prevents you from deleting files that are currently in use to avoid causing crashes or data loss. An in-use file could be a document that's currently open, a program executable that's currently running, or a folder locked by a running application.

Most of the time, you can get around this by closing the application or restarting Windows, but it's not always that easy.

For instance, if the program has crashed, you'll need to use Task Manager to end the process. Or, if the program is actually a Windows service, you'll need to use the Services window (services.msc) to stop the service before you'll be allowed to delete the file.

There are times when Windows won't let you delete a file, not because it's in use, but because you don't have permission


But what if the file you're trying to delete is part of a virus? Or what if you know the file isn't open, but Vista still won't let you delete it?

6.1. Solution 1: Use the Command Prompt

Windows Vista has a special way to get to the Command Prompt without loading most of the rest of the operating system, not to mention any applications or services (or viruses) that can come along for the ride.

Once you're there, use the del command  to delete the file.

When that's done, close the Command Prompt window, or type exit and press Enter to restart your PC and load Windows.

6.2. Solution 2: Use Wininit.ini

If you don't want to use the Command Prompt, you can use another little-known trick that takes advantage of a feature used by application installers to replace program files.

First, open Windows Explorer and navigate to your C:\Windows folder. Double-click the Wininit.ini file to open it in Notepad (or any other standard plain-text editor).

If the file isn't there, just create a new empty text file, name it Wininit.ini, and type the following line at the top:

[rename]

(In most cases, the Wininit.ini file will exist but will be empty, with the exception of the [rename] line; any other lines you see here would've been added by a recent application installation.)

Under the [rename] section header, type the following line:

NUL=c:\folder\filename.ext

where c:\folder\filename.ext is the full path and filename of the file you wish to delete. You can specify as many files here as you want, one on each line.

To replace a file rather than simply deleting it, the syntax is a little different:

						c:\folder\existing.ext=c:\folder\replacement.ext

where c:\folder\existing.ext is the full path and filename of the file you're trying to replace, and c:\folder\replacement.ext is the full path and filename of the new file to take its place. If the file specified on the right side of the equals sign doesn't exist, then the existing.ext file will be moved/renamed to c:\folder\replacement.ext.

When you're done, save the file, close Notepad, and restart Windows. The files will be deleted or replaced as you've specified during the startup procedure.

 
Others
 
- Windows Vista : Working with Files and Folders (part 2)
- Windows Vista : Working with Files and Folders (part 1)
- Using Windows 7 Hardware Troubleshooting Tools : Troubleshooting with Windows 7 Troubleshooters (part 3) - Using Hardware Troubleshooters, Configuring Settings for Troubleshooters
- Using Windows 7 Hardware Troubleshooting Tools : Troubleshooting with Windows 7 Troubleshooters (part 2) - Running the Devices And Printers Troubleshooter
- Using Windows 7 Hardware Troubleshooting Tools : Troubleshooting with Windows 7 Troubleshooters (part 1) - Running Control Panel Troubleshooters
- Using Windows 7 Hardware Troubleshooting Tools : Troubleshooting with the Windows 7 Action Center
- Windows 8 : Customizing the Desktop and the User Interface - Optimizing Toolbars, Working with Desktop Themes
- Windows 8 : Customizing the Desktop and the User Interface - Customizing the Taskbar
- Windows Server 2008 : Perimeter Networks and Remote Access Strategies (part 3) - Designing a RADIUS Solution for Remote Access
- Windows Server 2008 : Perimeter Networks and Remote Access Strategies (part 2) - Designing a Remote Access Strategy
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us