#AmigaDos Help
5 messages in this thread
I'm trying to rename all the files in a directory using the AmigaDos
rename command, and nothing seems to work. The command I'm using is as
follows: "rename pic#? pic.#?" It's telling me that pic.#? is not a
directory. Any help would be greatly appreciated. I've tried about 100
different combinations and nothing goes. Thanks.
James,
AmigaDOS's rename command doesn't allow wildcard renames except to move
files from one directory to another (thus the message about pic.#? not being a
directory).
Don
James,
so far as I know, you can't do it with the Rename command. Instead,
what you need to do is use the List command with the LFormat= parameter to
create a batch file for you with all the appropriate info filled in, then
execute that. For instance, if I had a directory full of pictures named
pic01 through pic99 and I wanted to rename them all to pic01 through
pic.99, I'd issue the following command:
List >ram:temp "" LFORMAT="Rename %s frame%s"
What did I do here? I told List to give me a list of files, sending
the results to a file in the ram: drive called temp, of the files in the
current directory (that's what "" indicates) and list it with the
following format:
Rename == the command we want to do.
%s == give me the name of the file
frame%s == a made up combination of the word frame and the name of the
file (I'll explain that one in a minute)
Now here is where you break out your trusty text editor, or if you
don't want to use one, your wordprocessor. If you use your wordprocessor,
make very sure that when you go to save the file, save it in ASCII format
(usually under Export, or found under Save As). The reason I had to use
the word frame, and it could be any word not containing "pic", is that you
are going to be using the global search and replace function of your word
processor or text editor, and it's easy to confuse the software with too
many "pic" running around.
The next step is to select your global search and replace function,
search on "pic", replacing it with "." (a period). Next, search and
replace "frame" with "pic".
Next, after you have saved the file, as ASCII, go to the command line
and type:
Execute ram:temp
And that should do the rename. Cumbersome as heck, but without going
into ARexx, or using a third-party shell, that's the best I could come up
with.
It's a lot easier when the subsitution name does not involve a similiar
string. For instance, to rename all my anything.c files to anything.cpp,
all I have to type is:
List >ram:temp #?.c LFORMAT="Rename %s %spp"
and execute it.
I hope this helps.
Brian
bjbart@watserv.ucr.edu
Brian,
Thanks a lot for the help with the problem I had with Rename. I never
would have figured that one out.
James,
no problem. You might want to look into third party shells such as
CShell, KornShell, etc, if you want superior scripting capability. That
or start learning ARexx.
Brian
bjbart@watserv.ucr.edu