Jump to content
Sign in to follow this  
thexshadow

File copy frrom temp dir (wildcard)

Recommended Posts

thexshadow

Well, first post. I am trying to copy a file from the temp dir, the folder that I am copying files from has its name changed every so often (the first part of the name stays the same).

Example

FileCopy(@TempDir & "\BUDL1******\iclog.rar", "N.Files\Getter\iclog.rar", 9)
I already know its the wildcards, would there be a way around this?

Share this post


Link to post
Share on other sites
UberNuss

Try this and look for the file under "C:\"

; Try this and look for the file under "C:\"
#include <Constants.au3>
Global $iConsole
Global $sOutput = ""
$iConsole = Run(@ComSpec & ' /c dir "' & @TempDir & '\BUDL1*" /b /ad', _
        "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
While 1
    $sOutput &= StdoutRead($iConsole)
    If @error Then ExitLoop
Wend
$sOutput = StringStripWS(StringStripCR($sOutput), 3)
FileCopy(@TempDir & "\" & $sOutput & "\iclog.rar", "C:\iclog.rar", 1)

Here, we run a console command: "DIR", using the mimimalist /B switch and an attribute switch: "/AD", retrieving the output of the command: the name of an existing folder.

Edited by UberNuss

Das Häschen benutzt Radar.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.