excel - Batch file to search files in a folder -


i need bat file search excel files in folder. should following

  1. search in folder
  2. looks excel files after created date
  3. if older system date deletes excel file
  4. if not runs converter.js

can 1 help.

here go. remove echo's script once see output on screen. also, i'm not sure how running converter.js you'll need change line , if file dates in different format, you'll have re-arrange "%mm%/%dd%/%yyyy%" too.

@echo off setlocal enabledelayedexpansion  pushd "c:\location\of\files\"  /f "tokens=2 delims==" %%a in ('wmic os localdatetime /value') set "dt=%%a" set "yy=%dt:~2,2%" & set "yyyy=%dt:~0,4%" & set "mm=%dt:~4,2%" & set "dd=%dt:~6,2%"  /f "tokens=*" %%a in ('dir /o-d /b /tc *.xls') (   /f "tokens=1" %%b in ("%%~ta") (     if "%%b" neq "%mm%/%dd%/%yyyy%" (       echo del "%%a"     ) else (       echo run converter.js     )   ) ) popd 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -