5

Possible Duplicate:
How to force Windows XP to rename a file with a special character?

I have a 2GB file in windows which has a long file name FileTransfer.dll?Cmd=1&MN=1619353607&Dir=1&Mode=0&Off=0&TS=FA596160-1BFB-4113-9E10-B196243A73F3&CVN=5,0,0,32
I am not sure how it got the filename that way (perhaps from the download manager)

Now when I try to rename it, it says

---------------------------
Error Renaming File or Folder
---------------------------
Cannot rename file: Select only one file to rename, or use MS-DOS wildcards (for example, *.txt) to rename a group of files with similar names.
---------------------------
OK   
---------------------------

How do I rename this file? I cannot make use of this file in any other way(like loading).
I am on windows XP home(NTFS) and I haven't used linux till now

Edit :
dir /X gives me

E:\Downloads>dir /X
 Volume in drive E is x
 Volume Serial Number is c

 Directory of E:\Downloads

02/04/2010  05:44 PM    <DIR>                       .
02/04/2010  05:44 PM    <DIR>                       ..
01/27/2010  09:12 PM            49,745              1.l
01/28/2010  12:09 AM     2,501,894,144              FileTransfer.dll?Cmd=1&MN=16
19353607&Dir=1&Mode=0&Off=0&TS=FA596160-1BFB-4113-9E10-B196243A73F3&CVN=5,0,0,32

01/28/2010  12:09 AM         3,138,664              wget-log.1
10/19/2009  02:46 AM        43,137,416              zapSetup_91_008_000_en.exe
               4 File(s)  2,548,219,969 bytes
               2 Dir(s)  80,069,509,120 bytes free
3
  • The question mark in there is indeed weird. They can be created on Windows, surely. But there'd be no sane reason to do so.
    – Joey
    Feb 4, 2010 at 12:56
  • Did you disable 8.3 name creation somewhere? I see no short names in DIR /x
    – MartW
    Feb 4, 2010 at 13:32
  • Yes that is pretty odd, must be disabled. I would probably try DIR file*.* - you should get only 1 file, then try REN file*.* myfile.exe (or whatever extension you need). Serial number is also a little odd. You should run CHKDSK but only after recovering what you need.
    – jtreser
    Feb 5, 2010 at 12:12

4 Answers 4

3

Find the short name of the file by using DIR /X, you should then be use REN to rename the short name to a new name.

0
3

I recently discovered that invalid filenames in Windows can be manipulated using this syntax:

\\.\C:\somedir\filename

This can be used to delete or rename the offending file, as in these examples:

DEL \\.\C:\test\LPT1

REN \\.\C:\test\LPT1 file.txt

Testing shows that this syntax also works if the first part of the path is "\\?\" instead of "\\.\".

2

In many cases, the simplest way to do this is to quote the filename. [*]

rename "long-file-name-here" new-short-file-name

The quotes protect the wonky characters (? and & and others) from being interpreted by the shell as special characters. (In the Windows CMD shell, ? is a single-character wildcard. The quotes tell CMD not to interpret it that way.)

Sometimes this doesn't work for other reasons, and you'll need to resort to one of the other techniques mentioned. But this one is the one to try first.

[*] Unix shells would prefer single-quotes ('foo') instead of double-quotes ("foo") for complete protection from shell interpretation. The CMD shell seems to prefer double-quotes.

0

You could try moving all the other files out of the directory then from a console window do

e:
cd e:\Downloads
rename * <newname>

Hopefully the rename command's wildcard expansion will not baulk at the unexpected characters. You may even be able to try this without moving the other files out with a slightly more refined rename command:

rename FileTran* <newname>

(if you are unfamiliar with command line console windows: one can be started by running cmd via the run command on the XP's start menu, and when you are done give then exit command)

Not the answer you're looking for? Browse other questions tagged .