How to move one directory to another directory?

前端 未结 4 1540
暗喜
暗喜 2021-02-19 03:31

I have two folders

  1. myappdemo.com/VueGuides/services/iclean

  2. myappdemo.com/VueGuides/services/pics

I need to move iclea

4条回答
  •  攒了一身酷
    2021-02-19 03:59

    Use rename(). Note that if this runs on a web server, the web server user must have access to write to the target directory.

    rename("oldpath", "newpath");
    
    // in your case, assuming the script calling rename() 
    // resides in the directory above 'myappdemo.com'
    rename("myappdemo.com/VueGuides/services/iclean", "myappdemo.com/VueGuides/services/pics/iclean");
    
    // Or use full absolute paths
    rename("/path/myappdemo.com/VueGuides/services/iclean", "/path/myappdemo.com/VueGuides/services/pics/iclean");
    

提交回复
热议问题