humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
move
move($path,$new_path,$fail_if_exist=false); - данная функция используется для перемещения заданного файлаФункция на вход принимает параметры:
(добавлен с версии 4.6.3)
После отработки функция возвращает результат своей работы в скрипт :
Пример использования
<?php // Scenario: Demonstrates copying, moving, and verifying files $xhe_host = "localhost:7010"; // Connect functional objects if not already connected if (!isset($path)){ $path = "../../../Templates/init.php"; require($path); } // info echo "\n<span >file_os->" . basename (__FILE__) . "</span>\n"; // Example 1: Copy a file (preparation for moving) echo "\n\n1. Copy file (preparation for moving): "; $sourceFile = "test/test1.txt"; $targetFile = "test/test_copy.txt"; $overwrite = false; $result = SYSTEM::$file_os->copy($sourceFile, $targetFile, $overwrite); if ($result) { echo "File copied successfully\n"; } else { echo "Failed to copy file\n"; } // Example 2: Move the copied file echo "\n2. Move the copied file: "; $sourceFile = "test/test_copy.txt"; $targetFile = "test/test_move.txt"; $overwrite = false; $result = SYSTEM::$file_os->move($sourceFile, $targetFile, $overwrite); if ($result) { echo "File moved successfully\n"; } else { echo "Failed to move file\n"; } // Example 3: Verify that the file was moved echo "\n3. Verify that the file was moved: "; $filePath = "test/test_move.txt"; $fileExists = SYSTEM::$file_os->is_exist($filePath); if ($fileExists) { echo "File exists at new location\n"; } else { echo "File does not exist at new location\n"; } // Quit the application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7010" from xweb_human_emulator import * # начало echo("<hr><font color=blue>file_os.xxxxxxxxx</font><hr>") # 1 echo("1. Сделать копию файла : ") echo(file_os.copy("test\\test1.txt","test\\test_copy.txt",false),"<br>") # 2 echo("2. Переименовать : ") echo(file_os.move("test\\test_copy.txt","test\\test_move.txt",false),"<br>") # 3 echo("3. Проверка что файл переименовался : ") echo(file_os.is_exist("test\\test_move.txt"),"<br>") # конец echo("<hr><br>") # Quit app.quit()
#region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program:XHEScript { static void Main(string[] args) { // init XHE server = "localhost:7010"; InitXHE(); // начало echo("<hr><font color=blue>file_os.move</font><hr>"); // 1 шаг echo("1. Сделать копию файла : "); echo(file_os.copy("test\\test1.txt","test\\test_copy.txt",false)+"<br>"); // 2 шаг echo("2. Переименовать : "); echo(file_os.move("test\\test_copy.txt","test\\test_move.txt",false)+"<br>"); // 3 шаг echo("3. Проверка что файл переименовался : "); echo(file_os.is_exist("test\\test_move.txt")+"<br>"); // конец echo("\n\n"); app.quit(); } }
// подключим функциональные объекты, если еще не подключен xhe_host="127.0.0.1:7010"; echo=require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>file_os.move</font><hr>"); // 1 шаг echo("1. Сделать копию файла : "); echo(file_os.copy("test\\test1.txt","test\\test_copy.txt",false)+"<br>"); // 2 шаг echo("2. Переименовать : "); echo(file_os.move("test\\test_copy.txt","test\\test_move.txt",false)+"<br>"); // 3 шаг echo("3. Проверка что файл переименовался : "); echo(file_os.is_exist("test\\test_move.txt")+"<br>"); // конец echo("\n"); // Quit app.quit();
=============================================
File_os Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.