Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to write a batch file that goes into a folder and randomly swaps (renames) all the filenames. This folder has about 1000 files. So it is acceptable if there are few misses.

share|improve this question
I have to ask, why? And when you say randomly swaps, do you mean haphazardly or randomly? Do all the files make up a set of filenames that must remain constant? – Raystafarian Jul 23 '13 at 0:28
related take a look and try it out for yourself, then come back and tell us where you're stuck. – Raystafarian Jul 23 '13 at 0:31
"Do all the files make up a set of filenames that must remain constant" - yes, thats the tricky part. They are image sequences that need to randomized for each iteration. – MD Luffy Jul 23 '13 at 0:55
This random swapping reminds me of the ripper virus, which swapped information to corrupt a disk slowly. I would be wary of answering this question, as it seems to have a malicious intent (even if op wants to do this in jest) – SeanC Jul 31 '13 at 13:57
@SeanCheshire dude seriously ? You didnt bother to ask my use case but make ridiculous allegations like these. (Its related to making slideshow videos with ffmpeg for those who care) – MD Luffy Aug 5 '13 at 21:43

Appends random number to file name and preserves extension:

@echo off
setlocal enabledelayedexpansion

for %%F in ("C:\my photos\*.*") do ( 
    rename "%%~fF" "%%~nF!random!%%~xF" || (
        echo ERROR: "%%~fF"

exit /B 0
share|improve this answer

Are you connected to a network?

Are there any others (computers) on the network?

Do they know your password and username on the targeted user/computer

If so change your password, if a person on the network knows those details, they can modify your computer in any way, they could be the culprit, and are there any other changes that you have noticed, try change your password, if you don't have one, then make one, this will block out anyone from accessing your user, not your whole computer, but probably wont do anything else if it was just that folder

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.