I have a working batch file that I'm running through task scheduler to delete files with today's date in the file name. For now I'm manually entering the date into the filename ahead of time but at least this part works. I'm looking for the best way to have this automatically insert the variable. I can change the naming scheme to default if it cannot be as specific as I have in this example.
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
echo %mydate%_%mytime%
REM 2018-07-04_1040 PM
PushD "\\DISKSTATION\backups\Google Drive" && (
"forfiles.exe" /s /m "*2018-07-04*" /C "cmd /c del @path"
) & PopD