rename bug from CMD

G

Guest

Hi,

Someone has noticed that the rename command (from cmd.exe) has changed
its behavior? before I used to rename files like this:

rename new*.txt test*.txt

and it will rename the files like this:

newname.txt to testname.txt

Now it seems to "ovewrite" the name to something like this:

from newname.txt to testame.txt

Note that the "n" has been overwritten. Someone know some workarround to
this? The help does not give much info...

I have hundreds of CMD and BAT files that I need to change...

Thanks,

Mariano.
 
O

OKuma

It does the same thing in XP.

The problem is that the original file name is 7 characters long, and the new
filename is 8 characters long.

Rename will truncate the beginning of the wildcard characters until it meets
the same amount of characters in the original filename.

If you did rename new*.txt tst*.txt, you would get the proper results of
your file being renamed to tstname.txt

OKuma
 
G

Guest

Hi Okuma,

Well, teh ren command has changed, with some service pack (I have tested
with SP1 and does this bad renaming thing), but I can assure you in prior
versions the behavior was different. I'm trying to determine when that has
changed... in Windows 2003 Server, does the same bad thing. I'm pasting you a
KB article that describes the correct functionallity I have used in the past:

http://support.microsoft.com/default.aspx/kb/320167

You must read the notes at the bottom, quoted from there:

"The Rename function in Windows Explorer does not match the behavior of the
REN command you may use at a command prompt. For example, if you had files
that are named smitha.doc, smithb.doc, and smithc.doc, you could use the ren
smith*.doc smythe*.doc command. All file names automatically show the new
spelling, and are renamed smythea.doc, smytheb.doc, and smythec.doc."

So, maybe their is some registry value I can change to get the old behavior
back.

Thanks for your reply.

Mariano.
 
C

cquirke (MVP Windows shell/user)

On Thu, 29 Mar 2007 05:20:04 -0700, Pucara
"The Rename function in Windows Explorer does not match the behavior of the
REN command you may use at a command prompt. For example, if you had files
that are named smitha.doc, smithb.doc, and smithc.doc, you could use the ren
smith*.doc smythe*.doc command. All file names automatically show the new
spelling, and are renamed smythea.doc, smytheb.doc, and smythec.doc."

If you do a lot of bulk logic-based renaming, you may want to try the
free CK Rename utility. I don't know if it can be automated (and thus
replace Cmd-based renaming) but it's great for cleaning up
freshly-ripped .MP3 names etc. and you can see a preview of its
effects before "pulling the trigger" to commit these changes.

See http://www.musicsucks.com/CKSoft/index.htm


--------------- ----- ---- --- -- - - -
IRC is just multiplayer notepad.
 
G

Guest

Thanks to all for the workarrounds... I was using one too, a vbs script. I
like the batch one. Anyway I wonder why someone has to change that behavior,
don't make too much sense to me.

Thanks to all for the replies.

Mariano.
 
C

cquirke (MVP Windows shell/user)

And when REN wildcards don't do what you want, the traditional way is to use
for loops - then one has substrings, etc.

Argh, the dreaded For syntax... <twitch><gibber>
<is quitely leat away by attendant>

I've used For, but I always have to look up the syntax - I can never
remember it. It's pretty slippery and caveat-prone, so a fair bit of
testing is recommended before use on "real" things ;-)
Here is a thread where I explain how to use For for batch renaming.

Thanks. What often ambushes one with these things (in the Cmd.exe age
of expanded batch file syntax) is that using parentheses to block a
number of statements as a single "statment" may not be supported.


-------------------- ----- ---- --- -- - - - -
Tip Of The Day:
To disable the 'Tip of the Day' feature...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top