Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? File rename problem...

May
855
0
This is not strictly a TCmd/TCC problem, but since I did it with TCC, I'm hoping there's some way to undo it with TCC. You see, due to a malformed "ren" command (in a loop as I remember), I ended up with a whole bunch (21) of files with names like (this is accurate in terms of the length of the file name) "ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors That Were Stupid Renaming Files Using Wildcards.txt". These names can not be handled by TCC (can not copy, move, rename or delete them) because the names are too long. So the question is - is there any known way to rename them (I'd prefer to keep them). Windows Explorer (tried in desperation) is also unable to handle them.
 
I would try using a wildcard for the source name (preferrably one that is unique for a single one of those 21 files), and a short target name, for the REN or MOVE command. I'd try this with CMD.EXE if TCC cannot do it... Also, part of the problem may be that the path + filename is too long; I'd rename the directory holding the files to something like "X:\1" (i.e., into the root, with a single character name).
Good luck!

Oh, maybe an archiving command / program, or a full version of V could handle it...
 
I don't recall the details, but there's a construction beginning with, I believe, "\\?\" that can help with long file names.

That said, your file name seems about 100 characters shy of the usual MAX_PATH = 260 limit.
 
Use CMD.EXE. Change to the directory containing the offending files and use DIR /X to find their short names. Rename them using the short names.

Unfortunately, you can't do this in TCC. When you pass TCC a short filename, it automagically substitutes the long name before passing it on to Windows....
 
Steve, your solution worked. And I will note that the files were in the root directory of my Z:\ drive (a RAM disk) and so therefore the length of the full path could not be part of the problem. But thank you!

Vince, I can't explain what you say about my file names being shorter than the supposed limit, I just know that 1. The erroneous rename process stopped for any one file when it hit the limit whatever it was, and 2. I could not rename the files using "standard" techniques. And for whatever reason(s) "\\?\" did not work (and I tried it, using some variations, dozens of times). I probably spent two or three hours on it before making the posting.

And Charles, I didn't think to try cmd.exe, I just found out I couldn't do that in TCC. But, thankfully, problem solved, and satisfactorily to boot.

Thank you to all of you!
 
Vince, I can't explain what you say about my file names being shorter than the supposed limit, I just know that 1. The erroneous rename process stopped for any one file when it hit the limit whatever it was, and 2. I could not rename the files using "standard" techniques. And for whatever reason(s) "\\?\" did not work (and I tried it, using some variations, dozens of times). I probably spent two or three hours on it before making the posting.

The file name you posted poses no problem to a normal NTFS drive (see below). What kind of file system is on your ramdrive?
Code:
v:\> touch /c ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors
2012-12-13 19:36:20.444  V:\ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors
 
v:\> dir err*
 
Volume in drive V is DATA          Serial number is c007:d3e4
Directory of  V:\err*
 
2012-12-13  19:36              0  ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors
2012-08-09  20:42            109  error.btm
              109 bytes in 2 files and 0 dirs    4,096 bytes allocated
    6,677,204,992 bytes free
 
v:\> del ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors
Deleting V:\ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors
    1 file deleted
 
Vince, chkdsk reports it as being NTFS (which I was 99% sure was the case), although it is a RAM disk and not a physical hard disk (I somehhow doubted if that made a difference, and I was right - see below). As far as your tests succeeding, I have two notes to make: #1, There were two sequential blanks in the name I submitted (which maybe didn't survive the bulletin board if you copied the name from there), and #2, That was (obviously) not the "real" file name, it was a "transcription" of same (which was somewhat personal as my file names tend to be fully descriptive). However, I just created a file with that name (with the double blanks) on my RAM disk, and I was not able to delete it until I renamed it using the wildcard technique suggested in this thread. I also just created it on a "real", physical, hard disk, and I was not able to delete it there either without using the same technique.
 
I have no trouble with the "Err..." name, even with spaces/double spaces. Is it possible your actual filename contained troublesome characters?
 
Vince, I have no explanation for this either other than to say that I recreated a file with that name on both the RAM disk and on a physical hard disk before making the posting and, again, I was not able to copy, move, rename, or delete either of them using "standard" techniques. (I saved the problem file name into a file so there would could be no mistake(s).) I am showing the file name here with the spaces replaced by underscores so there can be no mistakes/misunderstandings.

ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors__That_Were_Stupid_Renaming_Files_Using_Wildcards.txt
 
Vince, I have no explanation for this either other than to say that I recreated a file with that name on both the RAM disk and on a physical hard disk before making the posting and, again, I was not able to copy, move, rename, or delete either of them using "standard" techniques. (I saved the problem file name into a file so there would could be no mistake(s).) I am showing the file name here with the spaces replaced by blanks so there can be no mistakes/misunderstandings.

ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors__That_Were_Stupid_Renaming_Files_Using_Wildcards.txt
That one gives me no trouble. ... anyone else? At 240+ characters, it's close to MAX_PATH = 260. Note that the DEL command shows that TCC used the "\\?\" path spec even though I didn't.
Code:
v:\> touch /c "ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors  That Were Stupid Renaming
Files Using Wildcards.txt"
2012-12-13 22:10:35.472  V:\ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors  That Were Stupid Renaming Files Using Wildcards.txt
 
v:\> del "ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors  That Were Stupid Renaming Files Using Wildcards.txt"
Deleting \\?\V:\ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors  That Were Stupid Renaming Files Using Wildcards.txt
    1 file deleted
 
Vince, I had no explanation for this, either; I just know that I am not 99.999% sure that things were as I represented them, I am 100% sure. (And I will note that the name is 251 characters long and there's no chance I made a mistake when acquiring that number.)

But I just did it yet another time using the name with the spaces with exactly the same results, no surprise. However I had no problems with the file when the spaces were replaced by underscores, and that was a surprise (for me). And I just found the answer to the question: a file delete with a leading "\\?\" (placed there manually by me) fails for a file name with underscores and succeeds if I don't manually add the leading "\\?", and I have no idea why that should be the case. And there is no way to remove the added "\\?" when the file name has spaces because the leading "\\?\" is placed there by TCC. cmd.exe (which doesn't do that) has no problem deleting either file.) Here is an unmodified transcript of a TCC session for reference.
Code:
  Thu  Dec 13, 2012  9:56:49p
 
Chill v1.1.0 loaded.
TCC: Plugin already loaded "Event64"
HTags plugin v0.60.3 loaded.
HTMLDump plugin v1.0.5 loaded.
ISO8601 plugin v1.3.7 loaded.
PopInfo v1.0.3 loaded; hotkey is Control-Q.
QCAL plugin v1.3.7 loaded.
SafeChars plugin v1.7.0 loaded.
Say plugin v1.0.7 loaded.
 
TCC  14.03.52 x64  Windows 7 [Version 6.1.7601]
Copyright 2012 JP Software Inc.  All Rights Reserved
Registered to Daniel Mathews
 
[Z:\]Type NUL: >ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors__That_Were_Stupid_Renaming_Files_U
sing_Wildcards.txt
 
[Z:\]del \\?\ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrors__That_Were_Stupid_Renaming_Files_Usin
g_Wildcards.txt
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
"\?\Z"
    0 files deleted
 
[Z:\]del ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrors__That_Were_Stupid_Renaming_Files_Using_Wi
ldcards.txt
Deleting \\?\Z:\ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrE
rrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors__That_Were_Stupid_Renaming_Files_U
sing_Wildcards.txt
    1 file deleted
 
[Z:\]type Nul: >"ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors  That Were Stupid Renaming Files
Using Wildcards.txt"
 
[Z:\]dir err*
 
Volume in drive Z is RAM Disk      Serial number is 8ab4:1647
Directory of  Z:\err*
 
12/13/2012  21:53              0  ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrors  That Were Stup
id Renaming Files Using Wildcards.txt
                0 bytes in 1 file and 0 dirs
      106,151,936 bytes free
 
[Z:\]del "\\?\ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErr
ErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrErrEr
rErrErrErrErrErrErrErrErrErrErrErrErrErrErrors  That Were Stupid Renaming Files Usi
ng Wildcards.txt"
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
"\?\Z"
    0 files deleted
 
[Z:\]
 

Similar threads

Back
Top