[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Is there any command for increment number in win cmd scrip? Need

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 18
Thread images: 1

File: 21132321213.jpg (49KB, 800x270px) Image search: [Google]
21132321213.jpg
49KB, 800x270px
Is there any command for increment number in win cmd scrip? Need fast rename some files
>>
>using batch
>>
use powershell
>>
>>56601181
install gentoo
>>
>>56601259
/thread
>>
>>56601181

>using the command line
>on windows

WHY would you do that if you're in the universal software development target platform? There's a program for EVERYTHING you wanna do on Windows, you don't have to suffer like on <insert_shitty_alternative_OS_name_here>.

Here you go, you can thank me later: http://www.bulkrenameutility.co.uk/
>>
Just use a for loop or something
Or a while loop, with an increment.
>>
>>56602444
I do not miss having to download terrible exes to do any little thing

goddomn it has been years and leaving windows was one of my best decisions ever

thanks wolfie
>>
>not googling

https://stackoverflow.com/questions/18304025/bulk-renaming-of-files-in-powershell-with-sequential-numeric-suffixes
>>
>nobody on /g/ is good enough at batch to just fucking answer OP's answer

I'm disappointed.

@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set ext=jpg
set n=1
set nf=0

for %%a in (*.%ext%) do (

IF !n!==1 (
set /A nf+=1
echo %%~na-!nf!.%ext%
ren %%~na.%ext% %%~na-!nf!.%ext%
)
)
ENDLOCAL


This appends a number to the end of the filename. If you wish to increment rename the files while ignoring the filenames, then simply change the "ren" line to "ren %%~na.%ext% !nf!.%ext%"
>>
>>56603146

B-but m-muh windows can't do the things ganoo_loonix can!
>>
Just select all files, press F2 and rename them. you will get an index at the end of the file between ( )
>>
>>56603431
>>56603146
Holy shit, why does Windows just keep wrecking the living shit out of freenux?
>>
IFS=$'\n'
INDEX=1
for filename in $(ls -1 *.jpg) ; do
mv "$filename" $INDEX
INDEX=$($INDEX+1 | bc)
done
[\code]

Might not work perfectly, haven't tried it.
>>
>>56603505

Should be

INDEX=$(echo $INDEX+1 | bc)


Now it works (also I fucked up the code tag)
>>
>>56603837

Err... replace that for with foreach. Fucked up in typing it.
>>
>>56603837
>Isn't that SIGNIFICANTLY EASIER TO UNDERSTAND?
no because i hate powershell and have been using batch for ages so this is not an issue.
>>
Again realized I fucked up the script. Should be:

$files = gci *.jpg
$count = 0

foreach ($file in $files) {
ren $file $($file.ToString().Replace(".jpg", "$count.jpg"))
$count += 1
}


But I digress, easier.

>>56603937

>have been using batch for ages
Yes, well, use something else. Your scripts are going to be a pain in the ass to maintain for anyone who isn't you. Windows supports Bash right now as well, so if you don't like Powershell, use Bash. Or write a script in Python or Ruby or Perl. Really, anything but that shit language that should have never existed.
Thread posts: 18
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.