A customer of mine processes data in tiles of 50x50m size, then merges them into larger tiles of 1x1km size. I wrote a QGIS plugin to take care of all necessary steps, but there are cases where is is simpler to circumvent QGIS and process larger areas at once. The problem is then that the rest of the workflow (converting the data for a web viewer and feeding a spatial index database) expects the data to be supplied in the mentioned tiles of one square kilometer.
Luckily, it is quite easy to move many individual tiles into folders for each square kilometer tile. The filenames are prefix_xmin_ymin.laz, where xmin and ymin correspond with the coordinates of the lower left corner. All that is required is splitting the file name by underscore, rounding down the lower left corner coordinates to full kilometers, then creating the corresponding folder and moving the file into it.
setlocal enabledelayedexpansion
for %%I in (*.laz) do (
for /f "tokens=2,3 delims=_" %%A in ("%%~nI") do (
rem echo %%A/1000 %%B/1000
set /a xtile=%%A
set /a ytile=%%B
set /a xmin=!xtile!/1000
set /a xunit=xmin*1000
set /a ymin=!ytile!/1000
set /a yunit=ymin*1000
mkdir tile_!xunit!_!yunit!
move %%I tile_!xunit!_!yunit!
)
)