Hi,

I hope someone can help me with this task. I need a script that can find
a latest created subfolder within a certain folder and copy a file into
it from another folder. Basically I need to copy a file into a folder
but the folder name periodically gets changed by third party
application.

Thanks,
Alex





*** Sent via Developersdex http://www.developersdex.com ***

Re: File copy by Pegasus

Pegasus
Wed Apr 23 17:24:29 CDT 2008


<Anubis> wrote in message news:%23wrRG4YpIHA.3940@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I hope someone can help me with this task. I need a script that can find
> a latest created subfolder within a certain folder and copy a file into
> it from another folder. Basically I need to copy a file into a folder
> but the folder name periodically gets changed by third party
> application.
>
> Thanks,
> Alex

You could do it with this simple batch file:
1. @echo off
2. set SourceFile=D:\User Files\Alex.txt
3. set TargetDir=c:\Program Files
4. for /F "delims=" %%a in ('dir /b /ad /od "%TargetDir%"') do set
Folder=%%a
5. copy /y "%SourceFile%" "%TargetDir%\%Folder%"
Do not retype this file - use copy & paste instead!