Save time by creating folders in bunches
By Scott Dunn Simplify file management by generating new folders from your right-click menu that automatically have the current date in the folder name. Run a four-line batch file from your context menu that creates whole hierarchies of folders that you name from the Command Prompt. |
Name folders based on their creation date
It's often useful to sort files into folders based on when the files were created. This is especially handy for storing digital photos. Of course, you can simply create a folder and name it manually. But it's much faster to add the date to the folder name automatically.
Date-based folders are more useful if their names are automatically sorted in chronological order. They won't sort chronologically if you use a date format such as "June 30, 2008."
But you can sort folders by date if you use the year-month-day format (for example, "2008-06-30"). This way, your folders will be listed in date order automatically when you sort them by name.
Start by choosing Windows' short-date format:
Step 1. Press the Windows key (Win) plus the letter R to open the Run dialog box. Type control intl.cpl and press Enter.
Step 2. In the Regional and Language Options Control Panel, click Customize (in XP) or Customize this format (in Vista).
Step 3. In the Customize Regional Options dialog box, click the Date tab.
Step 4. For Short date, choose yyyy-MM-dd from the drop-down list. Click OK twice.
Now add a command to your folders' context (or right-click) menu that names new folders based on this format.
In Windows XP, this can be done via Windows Explorer dialog boxes. Unfortunately, doing so triggers a Windows bug that can be fixed only by editing the Registry.
In Vista, you have to edit the Registry from the start, so it's best to use the Registry Editor to make the change in both Vista and XP.
Careless Registry changes can cause Windows to misbehave, so create a restore point before you begin. That way you can revert to the pre-modification Registry in case something goes wrong.
In XP, follow these steps to create a restore point:
Step 1. Choose Start, All Programs, Accessories, System Tools, System Restore.
Step 2. Select Create a restore point, click Next, and follow the instructions in the wizard to complete the process.
Follow these steps to create a restore point in Vista:
Step 1. Click Start, type SystemPropertiesProtection, and press Enter. Click Continue if prompted by User Account Control (UAC).
Step 2. Click Create. Type a name for your restore point, and press Enter. Click OK to acknowledge the completion of the process and OK again to close System Properties.
Now you're ready to add a new command to Explorer's context menu for folders:
Step 1. Press Win+R to open the Run dialog box. Type regedit and press Enter.
Step 2. In the tree pane on the left, navigate to and select:
HKEY_CLASSES_ROOT\Directory\shell
Step 3. (Optional) The next tip I describe entails returning to this location, so you may want to choose Favorites, then Add to Favorites; type a descriptive name; and press Enter to facilitate reopening the key.
Step 4. In the tree pane, right-click the shell icon and choose New, Key. Type a name, such as Date_Folder, and press Enter.
Step 5. With Date_Folder (or whatever you named the key) selected in the tree pane, double-click the (Default) icon in the right pane.
Step 6. In the Value Data box, type the command as you want it to appear on your context menu. For example, you might type "New folder with today's date" (without the quotation marks). Click OK.
Step 7. Right-click the Date_Folder key in the tree pane and choose New, Key. Name it command and press Enter.
Step 8. With the command icon selected in the tree pane, double-click the (Default) icon in the right pane.
Step 9. In the Value data box, type:
cmd.exe /c md "%1\%%DATE%%"
(including the quotation marks) and click OK. Exit the Registry Editor.
Now when you right-click a folder icon in Explorer or on the desktop, you'll see your new command. When you choose it, a Command Prompt window may briefly flash on screen.
The command creates a new folder inside the selected one, so you may find it easier to use on folders in the tree pane. If you don't see the new folder, press F5 to refresh the Explorer window.
Once the folder contains a folder named for the current date, the command can't create another folder with the same name. So once you invoke it, subsequent use of this command on the same folder will have no effect until the next day.
Mass-produce new folders via a batch file
By default, the only ways to create a folder in Explorer are to click File, New, Folder or to right-click in the right pane and choose New, Folder. If you need to make more than a few new folders at one time, this gets old very quickly.
Save time and trouble by adding a command to your folder context menu that lets you create all the new folders you wish — including a hierarchy of subfolders — almost as fast as you can type.
Start by creating a batch file that will generate new subfolders within any folder you right-click:
Step 1. Press Win+R to open the Run dialog box. Type notepad and press Enter.
Step 2. In Notepad, type the following four lines exactly:
@echo off
set /p name="Type one or more folder names: "
cd %1
md %name%
The first line hides the code from the Command Prompt window.
The second line prompts you to enter the folder names and then stores the names in a variable called Name.
Be sure to place one or more spaces before the closing quotation mark in line 2. That way, the names you type won't run up against the prompt in the Command Prompt window.
The other commands in the batch file switch the current folder to the one you right-clicked and create folders based on what you type at the prompt.
Step 3. Save the file to a location of your choice, for example C:\batch. Name the file something like manyfolders.cmd and then exit Notepad.
Next, add a command to launch the batch file from your folders' context menu. As in the context-menu customization I described above, this change requires some Registry editing:
Step 1. Set a restore point as explained above.
Step 2. Press Win+R to open the Run dialog box. Type regedit and press Enter.
Step 3. In the tree pane on the left, navigate to and select:
HKEY_CLASSES_ROOT\Directory\shell
(If you saved this key to your Favorites menu as part of the tip above, choose the entry there to open the key in a flash.)
Step 4. In the tree pane, right-click the shell icon and choose New, Key. Type a name such as Make_Folders and press Enter.
Step 5. With Make_Folders (or whatever you named it) selected in the tree pane, double-click the (Default) icon in the right pane.
Step 6. In the Value Data box, type the command as you want it to appear on your context menu. For example, you might type Make one or more folders. Click OK.
Step 7. Right-click the Make_Folders key in the tree pane and choose New, Key. Name the new key command and press Enter.
Step 8. With the command icon selected in the tree pane, double-click the (Default) icon in the right pane.
Step 9. In the Value data box, type:
"c:\batch\manyfolders.cmd" "%1"
(with the quotation marks) and click OK. Naturally, your path and batch file name may differ. Exit the Registry Editor.
Now when you want to make one or several new folders within another folder, right-click that folder and choose your new command. A Command Prompt window appears telling you to type the name(s) of your folder(s). Type the name of each folder you want to create at that location, separated by a space.
If you want a folder name to include spaces, put that name within quotation marks. To create folders within folders, use the \ symbol. When you're done, press Enter.
For example, if you type:
Mon Tue Wed Thu Fri
you create those five folders within the current folder. Typing:
Mon\draft Mon\final Tue\draft Tue\final Wed\draft Wed\final Thu\draft Thu\final Fri\draft Fri\final
creates five folders, each of which has two subfolders named "draft" and "final."
If you don't see your new folders, press F5 to refresh Explorer.
Note that you can use this command to create a single folder as well.
Bonus tip: Looking for a fast way to add a single subfolder without taking your hands off the keyboard? Select the parent folder in Explorer, press Alt+F, Enter, Enter. Type the new name and press Enter again.
Note that this technique doesn't work if you have an object selected in the right pane. To fix that, press Ctrl+Spacebar to deselect it before using the aforementioned key sequence.
Troubleshoot a balky folder-creation shortcut
If your new folder-generating commands don't work as expected, double-check your settings in the Regional and Language Options Control Panel and the text in your manyfolders.cmd batch file.
You may also need to reopen the Registry Editor and double-check the names and values of the keys you just added. Double-click the (Default) icon of any key whose commands you need to edit, make the required changes, and click OK.
If the batch file still refuses to run and you decide to remove the commands from the context menu, navigate to and select:
HKEY_CLASSES_ROOT\Directory\shell
in the Registry Editor, right-click the Date_Folder or Many_Folders key in the Registry Editor's tree pane, and choose Delete. Click Yes to confirm.
If the file causes other problems, choose Start, All Programs, Accessories, System Tools, System Restore. Select the restore point you created before starting the process to return your computer to its previous state.
No comments:
Post a Comment