![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject [<<]Thread
Number : 4331 Date : 2003-04-17 Author : Garry Deane Subject : Re: copy one 1 new file Size(KB) : 1
--- In xxcopy@yahoogroups.com, "carmenmiller" wrote: > hello all, > > all I want to do is copy the newest file in a folder > sometime more than 1 file is created on the same day. > and I want to copy just the newest one to another > folder > > thanks > carmen Since Xxcopy processes files in the "natural" disk order and it doesn't accept source files from an input list (sigh), you need another method to get the newest file. Typically you'd use a batch file to create a DIR listing in reverse date order, get the first file name from the list then copy that file. Below are a couple of example batch files assuming a copy from d:\test\*.txt to e:\test for the newest file less than 1 day old. Obviously adjust the file spec to suit your needs. The W9x/ME version uses a utility called LMOD but you could use other similar programs to do the same thing. Garry @echo off :: NT/W2k/XP version setlocal pushd d:\test for /f "tokens=*" %%a in ('dir /b/o-d *.txt') do ( set file="%%a"&goto :copy) :copy xxcopy %file% e:\test /po0/bi/da#1 goto :eof @echo off :: W9x/ME version using LMOD :: http://home.mnet-online.de/horst.muc/ d: cd d:\test dir /b/o-d *.txt|lmod set file="[]" > %temp%\tmpcopy.bat for %%a in (call del) do %%a %temp%\tmpcopy.bat xxcopy %file% e:\test /po0/bi/da#1 set file= cd \
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.