Jump to content

copy command Help


Recommended Posts

I need a command to copy the folder & a file from the directory that i am working in over to like "c:\temp" what should be the command for this? Can i just say copy whatever in this folder(current folder i am in) to c:\temp? Please advise

Link to comment
Share on other sites

FileCopy will copy files.

However, getting the directory if it's not the same every time and not a standard location may be a little more difficult. Check out the Macros for Directory and AutoIt related Macros in the help file to see if any of those will help.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

Can i just say copy whatever in this folder(current folder i am in) to c:\temp? Please advise

I'm bored so take below script just as an example. It will copy every file/directory (but script) in the folder to temp dir located in the same folder.

#include <file.au3>
$source = @ScriptDir & "\"
$directoryname = "temp"
$destination = @ScriptDir & "\" & $directoryname & "\"

$afilelist = _FileListToArray(@ScriptDir,"*",1)
$adirectoryList = _FileListToArray(@ScriptDir,"*",2)

If IsArray($afilelist) Then
    For $i = 1 To $afilelist[0]
        If $afilelist[$i] <> @ScriptName Then FileCopy($source & $afilelist[$i],$destination & $afilelist[$i],9)
    Next
EndIf

If IsArray($adirectoryList) Then
    For $i = 1 To $adirectoryList[0]
        If $adirectoryList[$i] <> $directoryname Then DirCopy($source & $adirectoryList[$i],$destination & $adirectoryList[$i])
    Next
EndIf
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...