如何将一个目录移动到另一目录? [英] How to move one directory to another directory?

查看:112
本文介绍了如何将一个目录移动到另一目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文件夹

  1. myappdemo.com/VueGuides/services/iclean

  1. myappdemo.com/VueGuides/services/iclean

myappdemo.com/VueGuides/services/pics

myappdemo.com/VueGuides/services/pics

我需要使用PHP将 iclean 文件夹移到 pics 文件夹中.

I need to move iclean folder into pics folder using PHP.

推荐答案

使用 rename() .请注意,如果它在Web服务器上运行,则Web服务器用户必须有权访问目标目录.

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");

这篇关于如何将一个目录移动到另一目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆