I planned to use gdal_translate to convert raster from uncompressed RGB geotiff to compressed(JPEG compression) YCBCR geotiff as a batch process. So I have created a .bat file using this code
for %%i in (*.tif) do gdal_translate -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -co TILED=YES %%i %%.tif
The code works fine but the problem is output rasters are created in the same path of input rasters. For example If input raster name is RGB.tif, after processing .bat file output created in the same folder with the name of RGB.tif.tif.
Is there any possibility to store output tiff in a separate directory? I have kept my input rasters in directory D:\work\RGB and I want to store output rasters in D:\work\YCBCR with the same name of Input.