Arran wrote:
> I want to be able to perform one or all of the following commands
> copy/move/open in a directory with multiple files and im only after the most
> recent one ive looked a xcopy but dont see how i could use it as it needs to
> be a independent command such that it can be run in a batch file at any date
> without any input.
>
> any ideas
Hi
Batch file that finds the most recent file and put it into
the environment variable newest (change C:\my_test to whatever
folder you want result from):
--------------------8<----------------------
@echo off
set folder=C:\my_test
for /f "tokens=1 delims=" %%a in ('dir /b /o:d "%folder%"') do set newest=%%a
if not "%newest%"=="" echo Newest file is "%newest%"
if not "%newest%"=="" echo Full path: "%folder%\%newest%"
--------------------8<----------------------
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scr...r/default.mspx