| Date: | Tue, 17 Sep 2002 11:30:50 -0700 |
| Reply-To: | "William W. Viergever" <wwvierg@ATTGLOBAL.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "William W. Viergever" <wwvierg@ATTGLOBAL.NET> |
| Subject: | Re: Win XP Filenames (OT) |
|
| In-Reply-To: | <8ab34ce9.0209170905.5a97800a@posting.google.com> |
| Content-Type: | text/plain; charset="us-ascii"; format=flowed |
|---|
At 10:05 AM 09/17/2002 -0700, Chris wrote:
>Does anyone know a way of modifying all filenames in a directory. I
>have around 400 files with dashes in the filename that I would like to
>remove. Anyone try anything like this with %sysfunc.
You mean via SAS?
If not and you don't care, then whip up a little BAT or CMD file to do the
renames.
As Windows' Explorer is piss-poor wrt to genning a list of files, you'll
need to open a "Command Prompt" (aka DOS box, C-prompt, etc.) and then once
you're in the desired directory, do a:
DIR *.S* /B (or whatever extension, filename mask) > redo.bat
(Note: the > is a pipe operator and will send the output of the DIR command
into a file named redo.bat)
... then using a good editor (e.g., Semware or UltraEdit), that has column
editing capabilities, it's pretty easy to take that list of file, copy it,
paste it over to the right and stick a "rename " in front of each line.
redo.bat starts as:
filename#1.sas7bdat
filename#2.sas7bdat
filename#3.sas7bdat
... etc
then ends as:
ren filename#1.sas7bdat newfilename#1.sas7bdat
ren filename#2.sas7bdat newfilename#2.sas7bdat
ren filename#3.sas7bdat newfilename#3.sas7bdat
... etc.
-----------------
Note:
If your desired directory is nested way deep and/or has a lot of blanks in
the name, it's sometimes a pain to do change drives and issue the CD
command(s) ... I've found it easier to invoke a "Command Prompt from w/i
Windows Explorer by pointing to the desired directory in Windows Explorer,
and doing a right-mouse-click and choosing "Command Prompt". To enable this
capability try this (this is how I do it in Win 2K):
Step 1. Open the My Computer icon on your Desktop (or open Windows Explorer).
Step 2. Pull down the Tools menu, click Folder Options, then select the
File Types tab.
Step 3. Scroll down the list of extensions to the "N/A" section, then
select N/A Folder. (An extension is usually "Not Applicable" to a folder,
hence the abbreviation.) Click the Advanced button.
Step 4. In the Edit File Types dialog box that appears, click the New button.
Step 5. In the Action box, type the words Command Prompt.
Step 6. In the Application Used To Perform Action box, type the command
"cmd.exe" (no quotes).
Step 7. Close the dialog box and click OK until you're back at the Desktop
or Explorer.
Once you've done all the above, you'll be able to right-click a folder in
Windows Explorer or My Computer, then click Command Prompt to open a
console on your selected folder. After your commands have run, type Exit to
close the console window.
HTH
------------------------------------------------------------
William W. Viergever Voice : (916) 483-8398
Viergever & Associates Fax : (916) 486-1488
Sacramento, CA 95825 E-mail : wwvierg@attglobal.net
------------------------------------------------------------
|