Jump to content

FileCopy


Recommended Posts

In the executable folder are two subfolder, 1 and 2.

1 contain some stuff, 2 is empty.

I have written:

 

Local $PORTABLEDIR1 = "1"
Local $PORTABLEDIR2 = "2"

FileCopy($PORTABLEDIR1 & "\*.*", $PORTABLEDIR2)

 

Not works (does't copy).

I have tryed also

 

Local $PORTABLEDIR1 =  @HomePath & "\1"

Local $PORTABLEDIR2 =  @HomePath & "\2"

 

Where is the mismatch?

Edited by Grof
Link to comment
Share on other sites

21 minutes ago, Grof said:

Why if I have a folder in exe path, I cannot use @HomePath to refeer it?

The short answer is because it would be the wrong macro.  A longer answer is because @HomePath resolves to the same location as the %HOMEPATH% environment variable.  So unless your script/exe is in the %HOMEPATH% folder, using that macro is WRONG.  If you would have spent a little more time in the Help file as others have suggested, you may have come across another macro named @ScriptDir which, as it is named, refers to the folder in which the script/exe is running. 

Link to comment
Share on other sites

"Why not use DirCopy? ".

I'm translating a NSIS algorithm, and because I'm learning, I'm trying to be closest to the original.

 

" If you would have spent a little more time in the Help file".

I have spent many time in the help file, but many things I haven't understood, many I' have forgotten, and don't forget I'm here only from 48 hours!

 

Anyway I've translated ALL the code except the registry routine.

Few minutes and I'll begin to write post about it! (And this wil be very hard, so get ready!!!).

Link to comment
Share on other sites

DirCopy is a command. It tells AutoIt to do something. @WorkingDir is a macro, a shortcut to tell AutoIt where to get the folder

These are not opposites, they are complementary.

; DirCopy ( "source dir", "dest dir" [, flag = 0] )
Consolewrite("@scriptdir "& @scriptdir&@CRLF)
Consolewrite("@workingdir "& @workingdir&@CRLF)
DirCopy(@scriptdir &"\*", @workingdir, 0)
; note that if the two macros have the same value, then nothing will happen :)

 

Skysnake

Why is the snake in the sky?

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...