/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Moving a directory with php

Hi,

I was wondering if there was a php function, like mkdir() and rename(), to move a directory to a different location along with the files listed under it.

The only thing I’m aware of is:

[code=php]move_uploaded_file ( string $filename , string $destination )[/code]

But I wasn’t sure if that could move a whole directory? The directories I need to move, would though, contain images that were uploaded through php. So maybe it could? But would it be able to move an empty directory? lol

I’ve also found out by mistake, that if I use the rename() and accidentally do the second part of the string to the wrong location, it’ll move the directory and delete it from its real location and rename it in the other location lol, but I’m not sure if that’s a consistent way to go about it, and if it would lose the files along the way.

Thanks for any help,
Jesi

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ZnupiFeb 25.2008 — [url=http://php.net/rename]rename()[/url] ?
Copy linkTweet thisAlerts:
@cinematic_jesiauthorFeb 25.2008 — I kept thinking after I posted this, that I could probably just use the rename(). But I wanted to be sure.. thanks for your help once again! lol.
×

Success!

Help @cinematic_jesi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...