copyAllFilesRecursive()

Copies files and subdirectories of a directory to a new directory.

Synopsis

bool copyAllFilesRecursive( string source, string target[, bool par3[, time time]]);

Parameters

Parameter Meaning
source Source directory. You can specify an absolute path or a relative path from the PROJ_PATH directory. NOTE: An empty string "" is interpreted as PROJ_DIR. If an empty string "" is used as source, the whole project is copied to the given path.
target Target directory. You can specify an absolute path or a relative path from the PROJ_PATH directory. NOTE: an empty string "" is interpreted as PROJ_DIR.
par3

(Preserve bit) only relevant for Linux, optional, default = false

0 File date = current time

Authorizations are either granted with user +rw or go+r

(Read and write rights for the user, read rights for a group and others)

1 time and authorization are imported (getFileTimes() setFileTimes() )

time optional if not present default = NullTimeVar. If a time indication is present, copying is only carried out if the age of the file to be copied is greater than the time indicated in time.

Return Value

If copying unsuccessful 0, copying ok 1

Errors

Description

All the files of the directory specified in source are copied to the directory specified in target, and subdirectories can also be copied.

Example

main()
{
  bool ok = 0;
  // The files in c:/test1 are copied to c:/test2.
  ok = copyAllFilesRecursive ("c://test1", "c://test2");
  // or also:
  //ok = copyAllFilesRecursive ("c://test1", "c://test2");
  if(!ok)
  {
    //...Error handling...;
    DebugN("Files were not copied", ok);
  }
  else
  {
    DebugN("Files were not copied", ok);
  }
}

Assignment

File function

Availability

CTRL