Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Windows Vista / General Topics / May 2008

Tip: Looking for answers? Try searching our database.

Command Line Ren (Rename) command broken?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SixSigmaGuy - 18 May 2008 01:03 GMT
I'm having trouble with the REN command with wild cards as used from the command prompt.  

For example, in the REN command help, it says:

"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 I try the example, exactly as described, I don't end up with smythea.doc, smytheb.doc, and smythec.doc.  

Instead, when I create three files named smitha.doc, smithb.doc, and smithc.doc and then execute the command:

ren smith*.doc smythe*.doc

I get:

C:\TestREN>ren smith*.doc smythe*.doc
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.

C:\TestREN>dir
Volume in drive C is OS
Volume Serial Number is 0A07-21F5

Directory of C:\TestREN

05/17/2008  04:04 PM    <DIR>          .
05/17/2008  04:04 PM    <DIR>          ..
05/17/2008  04:03 PM                 0 Smithb.doc
05/17/2008  04:03 PM                 0 Smithc.doc
05/17/2008  04:03 PM                 0 smythe.doc
              0 File(s)              0 bytes
              2 Dir(s)  48,010,428,416 bytes free

C:\TestREN>

This isn't how I recall REN working in previous versions of Windows.  Anyone know if the REN command has changed or been broken?
Rick Rogers - 18 May 2008 02:14 GMT
Hi,

Works fine for me here. Looking at your DIR results, it appears the wildcard
character, "a", wasn't carried on the first one. I just replicated your test
and here are the results:

Directory of C:\TestREN

05/17/2008  09:11 PM    <DIR>          .
05/17/2008  09:11 PM    <DIR>          ..
05/17/2008  09:11 PM             9,863 Test1.docx
05/17/2008  09:11 PM             9,887 Test2.docx
05/17/2008  09:11 PM             9,895 Test3.docx
              3 File(s)         29,645 bytes
              2 Dir(s)  77,118,971,904 bytes free

C:\TestREN>ren test*.docx work*.docx

C:\TestREN>dir
Volume in drive C has no label.
Volume Serial Number is 2176-638D

Directory of C:\TestREN

05/17/2008  09:12 PM    <DIR>          .
05/17/2008  09:12 PM    <DIR>          ..
05/17/2008  09:11 PM             9,863 work1.docx
05/17/2008  09:11 PM             9,887 work2.docx
05/17/2008  09:11 PM             9,895 work3.docx
              3 File(s)         29,645 bytes
              2 Dir(s)  77,118,185,472 bytes free

Signature

Best of Luck,

Rick Rogers, aka "Nutcase" - Microsoft MVP
http://mvp.support.microsoft.com/
Windows help - www.rickrogers.org
My thoughts http://rick-mvp.blogspot.com

I'm having trouble with the REN command with wild cards as used from the
command prompt.

For example, in the REN command help, it says:

"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 I try the example, exactly as described, I don't end up with smythea.doc,
smytheb.doc, and smythec.doc.

Instead, when I create three files named smitha.doc, smithb.doc, and
smithc.doc and then execute the command:

ren smith*.doc smythe*.doc

I get:

C:\TestREN>ren smith*.doc smythe*.doc
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.

C:\TestREN>dir
Volume in drive C is OS
Volume Serial Number is 0A07-21F5

Directory of C:\TestREN

05/17/2008  04:04 PM    <DIR>          .
05/17/2008  04:04 PM    <DIR>          ..
05/17/2008  04:03 PM                 0 Smithb.doc
05/17/2008  04:03 PM                 0 Smithc.doc
05/17/2008  04:03 PM                 0 smythe.doc
              0 File(s)              0 bytes
              2 Dir(s)  48,010,428,416 bytes free

C:\TestREN>

This isn't how I recall REN working in previous versions of Windows.  Anyone
know if the REN command has changed or been broken?
SixSigmaGuy - 18 May 2008 11:00 GMT
Your test didn't test the same thing.  You had 5 character filenames before
and after the rename, i.e., the lenght of the filename didn't change.  In
the case described in help, they renamed 6 character filenames to 7
character filenames.  It should have worked as they described, but it
didn't.  Try the test again, renaming SMITH?.DOC to SMYTHE?.doc.  It used to
work fine; now it doesn't.

> Hi,
>
[quoted text clipped - 72 lines]
> This isn't how I recall REN working in previous versions of Windows.
> Anyone know if the REN command has changed or been broken?
Rick Rogers - 18 May 2008 13:24 GMT
You're right, it appears to be an exact character replacement only. It goes
the other way as well, if the target name is shorter, the remaining
characters on the original are carried over as well, ie:

ren test*.docx wor*.docx

results in a file name of wort1.docx. I'll see what I can find out about
this.

Signature

Best of Luck,

Rick Rogers, aka "Nutcase" - Microsoft MVP
http://mvp.support.microsoft.com/
Windows help - www.rickrogers.org
My thoughts http://rick-mvp.blogspot.com

> Your test didn't test the same thing.  You had 5 character filenames
> before and after the rename, i.e., the lenght of the filename didn't
[quoted text clipped - 79 lines]
>> This isn't how I recall REN working in previous versions of Windows.
>> Anyone know if the REN command has changed or been broken?
Rick Rogers - 18 May 2008 22:02 GMT
Ok, had it tried in XPGold/XPSP1/XPSP2/Server2003/Server2008 and they all
exhibit the same behavior. Didn't have a Win2K system available. I suspect
this is the way the command works.

Signature

Best of Luck,

Rick Rogers, aka "Nutcase" - Microsoft MVP
http://mvp.support.microsoft.com/
Windows help - www.rickrogers.org
My thoughts http://rick-mvp.blogspot.com

> You're right, it appears to be an exact character replacement only. It
> goes the other way as well, if the target name is shorter, the remaining
[quoted text clipped - 88 lines]
>>> This isn't how I recall REN working in previous versions of Windows.
>>> Anyone know if the REN command has changed or been broken?
Rick Rogers - 20 May 2008 11:52 GMT
Hi,

An additional thought is to add a character space before renaming:

C:\TestREN>dir
Volume in drive C has no label.
Volume Serial Number is 2176-638D

Directory of C:\TestREN

05/20/2008  06:49 AM    <DIR>          .
05/20/2008  06:49 AM    <DIR>          ..
05/18/2008  07:52 AM             9,863 test1.docx
05/18/2008  07:52 AM             9,888 test2.docx
05/18/2008  07:52 AM             9,894 test3.docx
              3 File(s)         29,645 bytes
              2 Dir(s)  77,142,429,696 bytes free

C:\TestREN>for %l in (*.*) do ren %l _%l

C:\TestREN>ren test1.docx _test1.docx

C:\TestREN>ren test2.docx _test2.docx

C:\TestREN>ren test3.docx _test3.docx

C:\TestREN>ren _test*.docx works*.docx

C:\TestREN>dir
Volume in drive C has no label.
Volume Serial Number is 2176-638D

Directory of C:\TestREN

05/20/2008  06:50 AM    <DIR>          .
05/20/2008  06:50 AM    <DIR>          ..
05/18/2008  07:52 AM             9,863 works1.docx
05/18/2008  07:52 AM             9,888 works2.docx
05/18/2008  07:52 AM             9,894 works3.docx
              3 File(s)         29,645 bytes
              2 Dir(s)  77,142,429,696 bytes free

Signature

Best of Luck,

Rick Rogers, aka "Nutcase" - Microsoft MVP
http://mvp.support.microsoft.com/
Windows help - www.rickrogers.org
My thoughts http://rick-mvp.blogspot.com

> Ok, had it tried in XPGold/XPSP1/XPSP2/Server2003/Server2008 and they all
> exhibit the same behavior. Didn't have a Win2K system available. I suspect
[quoted text clipped - 92 lines]
>>>> This isn't how I recall REN working in previous versions of Windows.
>>>> Anyone know if the REN command has changed or been broken?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.