Copying DIR: ' , $from_dirspec , ' to:-
' , $to_dirspec , '' ;
// $ok = TRUE ;
// ---------------------------------------------------------------------
if ( $ok !== TRUE ) {
return <<' , $from_basename , '' ;
// =====================================================================
// All entries done ?
// =====================================================================
if ( $from_basename === FALSE ) {
break ;
}
// =====================================================================
// Skip "." and ".."...
// =====================================================================
if ( $from_basename === '.' || $from_basename === '..' ) {
continue ;
}
// =====================================================================
// Convert the FROM basename to pathspec...
// =====================================================================
$from_pathspec = $from_dirspec . '/' . $from_basename ;
// =====================================================================
// Get the TO pathspec...
// =====================================================================
$to_pathspec = $to_dirspec . '/' . $from_basename ;
// =====================================================================
// Process the FROM dir/file/link...
// =====================================================================
if ( is_dir( $from_pathspec ) ) {
// =================================================================
// DIR
// =================================================================
// -------------------------------------------------------------------------
// \greatKiwi_pluginMaker_pluginVersion_directoryOperations\copy_directory_tree(
// $from_dirspec ,
// $to_dirspec ,
// $question_strict = TRUE ,
// $question_overwrite = FALSE ,
// $levels = 0 ,
// $current_level = 0
// )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Copies the specified directory tree.
//
// In other words (by default), copies the specified directory and all of
// it's descendants.
//
// ---
//
// $question_strict:-
// o TRUE means that NONE of the destination dirs and files may
// already exist.
// o FALSE means that it's OK if any of the destination dirs and
// files already exist. If the destination item that already
// exists is a FILE, then $question_overwrite describes how
// this should be handled.
//
// ---
//
// $question_overwrite:-
// (Only used if $question_strict is FALSE.)
// o TRUE means that if a destination file already exists, then
// it MAY be overwritten.
// o FALSE means that if a destination file already exists, then
// it may NOT be overwritten. (Instead, the copy ends at this
// point - the existing file being a FATAL error.)
//
// ---
//
// $levels:-
// o If $levels is 0, then we copy ALL of the destination
// directory's decendants (no matter ho deeply nested they are).
// o If $levels is 1, then we copy only the DESTINATION
// DIRECTORY itself (but NONE of it's descendants).
// o If $levels is 2, then we copy the destination directory and
// it's children (but NOT it's grandchildren, etc).
// o And so on...
//
// ---
//
// $current_level:-
// o The level that we've nested down to (and are currently at).
//
// ---
//
// RETURNS
// o On SUCCESS!
// - - - - - -
// TRUE
//
// o On FAILURE!
// - - - - - -
// $error_message STRING
// -------------------------------------------------------------------------
$result = copy_directory_tree(
$from_pathspec ,
$to_pathspec ,
$question_strict ,
$question_overwrite ,
$levels ,
$current_level + 1
) ;
// -----------------------------------------------------------------
if ( is_string( $result ) ) {
closedir( $dir_handle ) ;
return $result ;
}
// -----------------------------------------------------------------
} elseif ( is_file( $from_pathspec ) ) {
// =================================================================
// FILE
// =================================================================
// -------------------------------------------------------------------------
// bool copy ( string $source , string $dest [, resource $context ] )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Makes a copy of the file source to dest.
//
// If you wish to move a file, use the rename() function.
//
// source
// Path to the source file.
//
// dest
// The destination path. If dest is a URL, the copy operation may
// fail if the wrapper does not support overwriting of existing
// files.
//
// Warning: If the destination file already exists, it will be
// overwritten.
//
// context
// A valid context resource created with stream_context_create().
//
// Returns TRUE on success or FALSE on failure.
//
// (PHP 4, PHP 5)
//
// CHANGELOG
// Version Description
// ------- -----------------------------------------------
// 5.3.0 Added context support.
//
// 4.3.0 Both source and dest may now be URLs if the "fopen
// wrappers" have been enabled. See fopen() for more
// details.
// -------------------------------------------------------------------------
$ok = copy( $from_pathspec , $to_pathspec ) ;
// echo '
Copying FILE: ' , $from_pathspec , ' to:-
' , $to_pathspec , '' ;
// $ok = TRUE ;
// -----------------------------------------------------------------
if ( $ok !== TRUE ) {
closedir( $dir_handle ) ;
return <<
Copying (SYMBOLIC) LINK: ' , $from_pathspec , ' to:-
' , $to_pathspec , '' ;
// $ok = TRUE ;
// -----------------------------------------------------------------
if ( $ok !== TRUE ) {
return <<