copyAllFiles()

Copies all the files of the specified directory to a new directory.

Synopsis

bool copyAllFiles(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 authorizations 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 is unsuccessful 0, copying ok 1

Errors

Description

See above, nonexistent subdirectories are automatically created.

Example

main()
{
  bool ok = 0;
  // The files in c:/test1 are copied to c:/test2.
  ok = copyAllFiles ("c://test1", "c://test2");
  // or also:
  // ok = copyAllFiles ("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