Copy files from latest folder

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

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 •

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

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 •

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.


Report •

Related Solutions

Ask Question