You have a list of files:

You have a list of files:
file1.jpg, file5.jpg, file9.jpg
You need change their filenames so that they are in sequential order, without any numerical gaps.

file1.jpg, file2.jpg, file3.jpg

You may only use a windows .bat script to accomplish the task.

How?

Attached: CNNvDtrump.jpg (600x319, 45K)

Other urls found in this thread:

youtube.com/watch?v=KEkrWRHCDQU
twitter.com/NSFWRedditImage

i dont code lol
i only play vidya and shitpost here :)

@echo off
ren file1.jpg file1.jpg
ren file5.jpg file2.jpg
ren file9.jpg file3.jpg

youtube.com/watch?v=KEkrWRHCDQU

what if there are a million files?

The question never asked for that.

@echo off
ren file1.jpg file1.jpg
ren file5.jpg file2.jpg
ren file9.jpg file3.jpg
...
ren file4865759.jpg file9999998.jpg
ren file5676376.jpg file9999999.jpg
ren file1471638.jpg file1000000.jpg

I use vim to copy and modify the line a million times with a single macro

retard

power shell
Dir | %{Rename-Item $_ -NewName ("file{0}.jpg" -f $nr++)}

overwrites existing files

your problem not mine

x = 1
y = 1
z = true
while z
if exists(file$x.jph) do
rename(file$x.jpg, file$y.jpg)
else
z = false
done
x = x + 3
y = y + 1
done
I even remember you incremented the file names by 3. You don't get batch though because I don't know it.

Let's see if I still remember some batch after all those years (not on Windows so I can't test it beforehand).
@echo off
SETLOCAL EnableDelayedExpansion

SET /A "_counter=0"
FOR %%A IN (*.jpg) DO (
SET /A "_counter+=1"
REN "%%A" !_counter!.jpg
)

>windows
cortana can't do this for you?

based retard

I would unironically use irfanview batch rename because its a GUI without all this gay command line stuff.

Figure it out on your own, faggot. The absolute state of Jow Forums man.. can't even use an internet search engine

That probably won't work, because.... Why the fuck do you have exclamation marks?

Also, I tried like this exact solution once, and I got poopity poop.

>That probably won't work
Very likely. It's been years since I last used Windows and wrote batch scripts.
>Why the fuck do you have exclamation marks?
Because of EnableDelayedExpansion. %_counter% would be 0 every time. !_counter! gets incremented by one with each loop.

I might love you, you old bastard. God damn web guides leave out little important details like this.

DO YOUR OWN HOMEWORK NIGGER
DIE
DIE DIE
PLESE DIE

This isn't homework.

OP here, this was 100% what I needed.

I was so close to figuring that out on my own, but the information I was using online neglected to mention the VERY IMPORTANT need of those EXCLAMATION MARKS!
XD

My code is performing exactly to my desires now.

>XD
>windows .bat script
kill yourself

It's not your code it's code you copied and pasted from Jow Forums.

I would, but it would require a privilege escalation.
Asimov's four laws of robotics prohibits this.

>implying I used his code directly

Why the fuck would I want all capitals in my script? I needed the !variablehere! delimiter syntax, not his style/lack of style.

I was just sitting here thinking, damn, this mofo is a DOS dev, all them caps baby.

My script command looks nothing like homedawg's example.

do share your solution

If you want to get hyper technical though.

It's nobody's code, because you can't own concepts.

Software instructions are just guides for how to do something, and are not a tangible asset to themselves.

Any user is free to use free code, and this forum expounds no tangible ownership to what are at it's core, just mathematical concepts.

Attached: rmscallout.jpg (1600x900, 464K)

and programmers wonder why everyone thinks they're cunts

OPs just trying to organize his p0rn library fag. Fuck off if you can't help.

OP here, I have noticed an issue.

It seems that file31.png is being processed AFTER file100-299.png is processed, thus making the end result out of order...

Can I make it process these in an order dependent on the numerical value, and not just off of whether or not the first digit character is alphanumerically after the other?

>Can I make it process these in an order dependent on the numerical value, and not just off of whether or not the first digit character is alphanumerically after the other?
Not that I know of. However you could adjust the for loop to loop through the numbers used in the input filenames instead of the files themselves.
FOR /L %%A IN (, , ) DO ( )

Yeah, that's what made my problem in the first place.

(1,3,300)

Gotta have that 3

Thanks, didn't do exactly what you said, but that helped me figure out what to do.

Fuck off and do your job

WinRAR and /thread.