Thursday, October 23, 2008

Rename files

I often have to rename files with the additional file extention .reject.
I basically just want to remove the .reject extention and keep the rest of the file.

This is the typical dirctory listing
C:\Apps>dir \\seit1705\D-Share\test\
 Volume in drive \\seit1705\D-Share is SEIT1705
 Volume Serial Number is 78E4-8FB3

 Directory of \\seit1705\D-Share\test

 2008-10-23  13:25  .
 2008-10-23  13:25  ..
 2007-10-03  16:45  1 144 E_DepSub_RME.xml.reject
 2007-10-03  16:45  1 144 E_DepSub_RME1.xml.reject
 2007-10-03  16:45  1 144 E_DepSub_RME2.xml.reject
 2007-10-03  16:45  1 144 E_DepSub_RME3.xml.reject
               4 File(s)          4 576 bytes
               2 Dir(s)  15 828 320 256 bytes free

You would think that this would do it:

ren \\seit1705\D-Share\test\*.reject *

But no... that command does NOTHING.

Ok, what about this:
ren \\seit1705\D-Share\test\*.reject *.xml


Nope, it produces this:
C:\Apps>dir \\seit1705\D-Share\test\
 Volume in drive \\seit1705\D-Share is SEIT1705
 Volume Serial Number is 78E4-8FB3

 Directory of \\seit1705\D-Share\test

2008-10-23  14:47              .
2008-10-23  14:47              ..
2007-10-03  16:45             1 144 E_DepSub_RME.xml.xml
2007-10-03  16:45             1 144 E_DepSub_RME1.xml.xml
2007-10-03  16:45             1 144 E_DepSub_RME2.xml.xml
2007-10-03  16:45             1 144 E_DepSub_RME3.xml.xml


Not what we want.

Solution:

ren \\seit1705\D-Share\test\*reject *xml


Amazingly works!

No comments: