Page 1 of 1
Renumbering image sequences (PowerShell)
Posted: Thu May 06, 2021 5:41 pm
by peter_b
Code: Select all
$FOLDER = "C:\wherever\myfilm";
$i = 1;
$files=Get-ChildItem $FOLDER -Filter *.tif
Foreach($obj in $files){
$index= "{0:000000}" -f $i;
$pathWithFilename=$FOLDER +"\"+ $obj.Name;
$in=$pathWithFilename;
$out=$FOLDER + "\LLUVIA.$index.tif";
Write-Output "In: $in";
Write-Output "out: $out";
Rename-Item -Path $in -NewName $out;
$i++;
Write-Output "-"
}
Re: Renumbering image sequences (.bat)
Posted: Thu Sep 23, 2021 10:08 pm
by ^rooker
I found this piece of code in my notes.
I don't know if it ever worked though, and it may be a copy/paste from a forum or website:
Code: Select all
@echo off
echo.
setlocal
set N=0
set FILENAME=baseFileName.%N%.tif
:loop
set /a N+=1
set FILENAME=baseFileName.%N%.tif
if exist %FILENAME% goto :loop
echo You can safely use this name %FILENAME% to create a new file
endlocal
But maybe it has elements of truth in it that may be useful for someone else?