Yussi Ariefiyono
get the latest file with batch command
Problem:
get the latest file in the folder with batch command, in my case after getting the latest file. i will move it to other directory
Solution:
copy and paste this code, change it according to your need
@echo offsetlocal:source directoryset srcDir= your source directory:destination directoryset destdir=your destination directoryset lastmod=pushd “%srcDir%”for /f “tokens=*” %%a in (‘dir /b /od 2^>NUL’) do set lastmod=%%aif “%lastmod%”==”" echo Could not locate files.&goto :eof:copycopy “%lastmod%” “%destdir%”:deletedel “%lastmod%”
enjoy
| Print article | This entry was posted by yussi ariefiyono on April 8, 2010 at 7:02 am, and is filed under batch command. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |