When you've worked with the Unix or DOS command lines, you get frustrated by the limitations of windowing interfaces. For example, how do you rename every file in a folder at once? In Windows you can't. In DOS, you use the ren command together with wildcard characters, as follows:
C:>ren ??acad06*.* ??acad07*.*
I did that today, renaming 28 chapter files of one of my AutoCAD books -- with one command, instead of renaming each of the 28 files, one at a time. By coincidence, Bob McNeel today also released an updated set of DOS-oriented LISP functions for AutoCAD, IntelliCAD, TurboCAD, and other programs that use LISP.
DOSLib is the name of the library that gives LISP functions similar to those in Windows and DOS. It's been tested on AutoCAD 2000 - 2007. For example:
dos_chkdsk - Returns drive space statistics.
dos_closeall - Closes all open AutoCAD drawing files.
dos_mkdir - Makes new directories.
dos_rename - Renames files.
Some functions are new, such as:
dos_arxlist - Returns a list of loaded ARX applications.
dos_extractpreview - Extracts the preview image from the active document.
dos_pathquotes - Adds or removes double-quote characters to a path string.
DOSLib is free; download here.
Tip
It can be a pain getting to a specific folder at the command line. Here's a shortcut:
1. In Windows Explorer, go to the folder.
2. In the Address box, select and copy the path.
3. In the Command Prompt window, enter the cd command, and then right-click. Windows pastes the path.
C:/> cd [right click] D:\Books\Using AutoCAD 2007 Basics - April 05
4. Press enter, and you're in the folder.
"and then right-click. Windows pastes the path."
Good grief, I've been choosing "Edit-Paste" from the menu all these years since "Ctrl+V" doesn't work...
Thanks for the right-click tip...
Posted by: Grady | Mar 31, 2006 at 04:43 AM
"For example, how do you rename every file in a folder at once?"
I know this isn't your point, however in Windows XP they introduced the functionality to rename multiple files - just multi select, rename "one" of them and the rest with follow with an intellegent increment - (1) being the default, but you can manipulate this. Cheers.
Posted by: me | Mar 31, 2006 at 07:12 AM
Check out the "Open Command Window Here" PowerToy from Microsoft. Much easier way to get a command prompt in a folder from Explorer.
http://tinyurl.com/2meyw
Posted by: vajrang | Mar 31, 2006 at 07:17 AM
"...how do you rename every file in a folder at once?"
Ant Renamer (opensource)
http://www.antp.be/software/renamer
Ant Renamer makes it easy to rename a large number of files at once. You can specify a list of files and can specify a sequence of renaming actions to apply to the file list, for example :
* move/delete characters
* replace characters with others,
* multiple string replacement
(eg replace "January" with "01", "February" with "02", etc)
For each renaming action you specify , there is a preview of what the renaming action does. You can then save the series of renaming actions to a batch file for future use and also preview the entire series acting on your specified list of files before actually doing so.
Another less powerful renaming program (but some may find simpler to use) is Oscar's File Renamer (freeware)
http://www.mediachance.com/free/renamer.htm
Dev T
Posted by: Dev Anand Teelucksingh | Mar 31, 2006 at 10:20 AM
Even better, just drag the folder from Windows Explorer and drop it on the command prompt.
Posted by: Fred | Apr 05, 2006 at 11:18 AM
How can you rename multiple files in a whole directory tree, i.e. include all files in sub-folders? I've tried every trick above but none seem to do this?
Posted by: Steve | Feb 17, 2007 at 03:24 AM