I know this isn't technically programming but I didn't see anywhere it fit better. Feel free to move it.
Okay, so what I'm trying to accomplish is adding a random combination of numbers or letters or both to the beginning of a large list of files in batch. So far I've tried:
For /D %%i IN (*) DO rename "%%i" "%random%%%i"[/CODE]
But batch only runs a single random number with this and sets them all to that same number.
I've also tried adding something like "%%~zi" to the rename which grabs the file size but since it's a folder this returns 0.
The creation date tag "%%~ti" would work if chopped down to the last milliseconds but it appears the only way to even get at this value is to save it as a text file but it appears batch doesn't allow you to pull the content of a text file into a variable whilst inside of the FOR command.
and now I'm all out of ideas..
I have python installed so if anyone knows of a script to accomplish this I'm all ears but I haven't worked with it enough myself to accomplish this in a reasonable amount of time.
A study by physicist Henry Tye of Cornell University suggests that the universe may not expand forever. Instead, it could eventually stop expanding, begin contracting and end in a "Big Crunch" roughly 20 billion years from now.
Maybe not as we now know that time can flow backwards.
It is clear from this aricle that "Time Is On My Side" no matter which direction it is flowing.,
https://noai.duckduckgo.com/?i...m%2Fwatch%3Fv%3DsEj8lUx0gwY
Matt Dinniman
I’m happy to announce that our friends at Peacock have officially greenlit the Dungeon Crawler Carl television series! Me, Chris Yost and Seth MacFarlane and his team at Fuzzy Door are all really excited to get to work. In the coming weeks I'll have more details, and if you're going to SDCC be sure to catch me and Chris on our DCC panel, but in the meantime I wanted to thank you, the fans, for helping make this happen.
— with Peacock TV and Seth MacFarlane.
Question
hobblyhoy
Hi all,
I know this isn't technically programming but I didn't see anywhere it fit better. Feel free to move it.
Okay, so what I'm trying to accomplish is adding a random combination of numbers or letters or both to the beginning of a large list of files in batch. So far I've tried:
But batch only runs a single random number with this and sets them all to that same number.
I've also tried adding something like "%%~zi" to the rename which grabs the file size but since it's a folder this returns 0.
The creation date tag "%%~ti" would work if chopped down to the last milliseconds but it appears the only way to even get at this value is to save it as a text file but it appears batch doesn't allow you to pull the content of a text file into a variable whilst inside of the FOR command.
and now I'm all out of ideas..
I have python installed so if anyone knows of a script to accomplish this I'm all ears but I haven't worked with it enough myself to accomplish this in a reasonable amount of time.
Thanks for reading,
~hobbly
Link to comment
https://www.neowin.net/forum/topic/1116891-batch-file-rename-folders/Share on other sites
1 answer to this question
Recommended Posts