Copy folders (win & linux)

Source: Internet
Author: User
& Nbsp; copy the folder to another place. * System folder eg: copy wordpress under D: wwwroot to D: wwwrootwwwexplorer1_del1 without adding a slash. if the source folder name is not added to the copy address, the following wordpress files are copied to D: wwwrootwwwexplorerw.del copies the folder to another place.

* System folder eg: copy wordpress under D:/wwwroot/to D:/wwwroot/www/explorer/0000/del/1/Without a slash, copy address if the source folder name is not added, the following wordpress files will be copied to D:/wwwroot/www/explorer/0000/del/1/* $ from = 'd: /wwwroot/wordpress '; * $ to = 'd:/wwwroot/www/explorer/0000/del/1/wordpress ';*/

You can directly use rename to Cut files and folders. The fastest and best way.

Eg:
For folders:
Set D:/wwwroot/wordpress
Cut to D:/wwwroot/www/explorer/0000/del/1/wordpress
Zhi 'Ji rename ($ path_copy, $ path_past. $ filename .'/');

For files
Set D:/wwwroot/wordpress/test. php
Cut to D:/wwwroot/www/explorer/0000/del/1/wordpress/, that is
Rename ($ path_copy, $ path_past. $ filename );

/*** Copy the wordpress under the D:/wwwroot/folder to the D:/wwwroot/www/explorer/0000/del/1/folder without a slash, copy address if the source folder name is not added, the following wordpress files will be copied to D:/wwwroot/www/explorer/0000/del/1/* $ from = 'd: /wwwroot/wordpress '; * $ to = 'd:/wwwroot/www/explorer/0000/del/1/wordpress'; */function copy_dir ($ source, $ dest) {$ result = false; if (is_file ($ source) {if ($ dest [strlen ($ dest)-1] = '/') {$ __dest = $ dest. "/". basename ($ source);} el Se {$ __dest = $ dest;} $ result = @ copy ($ source, $ __dest); // echo iconv ($ config ['app _ charset'], $ config ['system _ charset'], $ source); @ chmod ($ __dest, 0755);} elseif (is_dir ($ source )) {if ($ dest [strlen ($ dest)-1] = '/') {$ dest = $ dest. basename ($ source); @ mkdir ($ dest); @ chmod ($ dest, 0755);} else {@ mkdir ($ dest, 0755); @ chmod ($ dest, 0755);} $ dirHandle = opendir ($ source); while ($ file = readdir ($ dirHandle) {I F ($ file! = "." & $ File! = "..") {If (! Is_dir ($ source. "/". $ file) {$ __dest = $ dest. "/". $ file;} else {$ __dest = $ dest. "/". $ file;} $ result = copy_dir ($ source. "/". $ file, $ __dest) ;}} closedir ($ dirHandle);} else {$ result = false;} return $ result ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.