Copy files from latest folder

ILGUser February 5, 2009 at 11:01:06
Specs: Windows XP
Hi,

I am trying to figure out how to copy files/folders from the latest folder. Meaning the folder is automatically generated on a particular date. It will always be different.

example Z:\27-Jan-09\Content.txt

In batch how to copy "Content.txt" if I do not know the folder name is going to end up as "27-Jan-09",

Please advice,
Thank You & Have a Great Day!


See More: Copy files from latest folder

Report •


#1
February 5, 2009 at 11:44:29
If you don't mind the wait time searching for a file with the name "Content.txt" then the DOS command file sst.exe will do it for you.
You can still get it here (see sst53a.zip):
http://archives.scovetta.com/pub/fe...

You put sst.exe itself in c:\windows\system32

See the doc file in the zip. You call it up as part of your batch file and with the appropriate switches I have used it to delete file types it has found.
It's about certain you could make it copy the file instead, once it has found it for you.

It's not exactly supersonic (as they put it) but if you decide to go that way I can probably shake the rust off and help you if necessary. The file is quite safe, I've used it for years.

Maybe someone will come up with some process which does not require a file search. Otherwise, I've not looked at all the files in that list for anything more appropriate to your needs, although at a glance it looked unlikely.

some other bloke...


Report •

#2
February 5, 2009 at 14:04:38
@echo off & setLocal EnableDelayedExpansion

pushd Z:\

for /f "tokens=* delims= " %%a in ('dir/b/ad/o-d') do (
echo copy "%%a\Content.txt" c:\files
goto :eof
)


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions


Ask Question