move all files in a folder to another?

前端 未结 11 1978
一个人的身影
一个人的身影 2020-12-01 04:01

when moving one file from one location to another i use

rename(\'path/filename\', \'newpath/filename\');

how do you move all files in a fol

11条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 04:12

    If the target directory doesn't exist, you'll need to create it first:

    mkdir('newpath');
    rename('path/*', 'newpath/');
    

提交回复
热议问题