Re: copy/open/move file most most recent datestamp from command li
From: Arran (Arran_at_discussions.microsoft.com)
Date: 10/27/04
- Next message: BlueRiff88: "Cannot connect to internet"
- Previous message: Fritz: "Re: disk partition"
- In reply to: Torgeir Bakken \(MVP\): "Re: copy/open/move file most most recent datestamp from command line"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 27 Oct 2004 13:39:06 -0700
Torgeir
thats perfect! works a treat thanks
arran
"Torgeir Bakken (MVP)" wrote:
> 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/scriptcenter/default.mspx
>
- Next message: BlueRiff88: "Cannot connect to internet"
- Previous message: Fritz: "Re: disk partition"
- In reply to: Torgeir Bakken \(MVP\): "Re: copy/open/move file most most recent datestamp from command line"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|