Welcome!

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

SignUp Now!

Quirky behavior - converting to lower case

Dec
57
3
Using: TCC 32.10.21 x64

I use this to convert all the files in a folder to all lower case.

for /o:n %a in (*.mp4 *.mkv) do (ren "%a" "%@lower[%a]")

99% of the time it works perfectly , but every once in a while it randomly deletes the extension of a file. I just ran it on a folder containing 35 files and it deleted the extension of 3 of the files.

What am I doing wrong?
 
I think you do nothing wrong.

Maybe that's a "speed" problem.

You could try with a little delay like the following:
Code:
for /o:n %a in (*.mkv *.mp4) do (delay /m 30 & ren "%a" "%@lower[%a]")

OR you could try it with "move" instead "ren", with something like that ...
Code:
for /o:n %a in (*.mp4 *.mkv) do (move "%a" "%@lower[%a_]") & move *.mp4_ *.mp4 & move *.mkv_ *.mkv
 
Last edited:
Thank you for your suggestion, I will try it.

But why would TCC ever delete the extension when changing a file name to lower case? Seems like there is a bug in TCC somewhere.
 
Thats a good question. Maybe it's really a timing problem (file is locked yet or something like that). I had - not the same - but also weird behavior some years ago through timing problems with a sync process (via TCC) with an external drive) with setting of attributes (archive). But I could solve it with a little "delay" (added /G param for the command to display the percent progress - that was enough already). I had no problem over similar task with the native command line (CMD). Also possible is that an security software (AV scanner) has influence. I could never find out the REAL problem behind (also not analyzed long).

So, I am not sure if that is really a bug - for me it sounds more like problem as I described above. BUT I AM NOT SURE ABOUT!

Here, I tested with your command line with 45 files (multiple times) - was all correct.

However: annoying such things, I know!

PS: Technically, I would say: it does not a basically delete the suffix - instead it can't finish the process of renaming. The end result is the same of course.
 
Last edited:
Is there anything peculiar about the names of the files that lose their extension? What happens if you repeat the experiment with a copy of the same set of files; are the same ones affected? You might try repeating the experiment alternating between @LOWER and @UPPER.

I tried with a few hundred files, several times, using your command verbatim, and got no misbehavior.
 
Is there anything peculiar about the names of the files that lose their extension? What happens if you repeat the experiment with a copy of the same set of files; are the same ones affected? You might try repeating the experiment alternating between @LOWER and @UPPER.

Following up on Vince's question, include things like multiple periods in the filename or embedded spaces, as well as special symbols or characters,
 
Back
Top