[cmd] Moving Whatsapp image script

Whatsapp 真係一個幾好用的溝通工具,不過佢的image storing 比較唔識合我屋企系統。在家中file 會分年月日來排但whatsapp 一個大folder 攪掂,所以我要寫個windows batch script 去改佢。
@echo off
set WHATSAPPIMAGEPATH=e:\Photo\WhatsApp Images\
echo @echo off > movewhatszppbatch.bat
echo rem selfgen whatsapp image moving script... >> movewhatszppbatch.bat
echo selfgen whatsapp image moving script.
echo it will create a batch file afterward, please review and run it later.
SET /P prefix=What is the image file prefix?
echo|set /p=Generating batch file. Please wait
setlocal EnableDelayedExpansion
FOR /f "tokens=1,2,3 delims=-" %%G IN ('dir /b "e:\Photo\WhatsApp Images\*.jpg"' ) DO (
echo|set /p=.
SET x=%%H
echo if not exist "E:\PHOTO\!x:~0,4!\!x:~0,4!_!x:~4,2!_!x:~6,2!" mkdir "E:\PHOTO\!x:~0,4!\!x:~0,4!_!x:~4,2!_!x:~6,2!" >> movewhatszppbatch.bat
echo move "%WHATSAPPIMAGEPATH%%%G-%%H-%%I" "E:\PHOTO\!x:~0,4!\!x:~0,4!_!x:~4,2!_!x:~6,2!\%prefix%-%%G-%%H-%%I" >> movewhatszppbatch.bat
)
echo pause >> movewhatszppbatch.bat
echo .
echo It's finished. Please review the batch file
notepad movewhatszppbatch.bat

Comments

Popular Posts