Lasso Soft Inc. > Home

[ file->copyTo ]

Method

The [file->copyTo] method copies the file referred to in the path of the [file] object to the new path specified by the first parameter. The method can take an optional second parameter which is a boolean that flags whether or not to overwrite an existing file. The default for this second parameter is false which means the method will not overwrite an existing file.

  • Syntax
local(f) = file(...)
#f->copyTo('/path/to/file.txt')

local(f) = file(...)
#f->copyTo('/path/to/file.txt', true)
Examples
  • Beginner

Copy a file from one folder to another

The code below copies the 'style.css' file in the '/css/' directory to the '/rhino/' directory. Afterwards, each folder will have a copy of the file.

Code

local(styles) = file('/css/style.css')
#styles->copyTo('/rhino/style.css')

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft