SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Script to move files?

    Hi all,

    I have a requirement to move (not copy) files on my server on a regular basis - but also to change the filenames of the files as I move them. For example, I have this:

    /mysite/public_html/newmedia/image1.jpg

    and I need to move it to here:

    /mysite/public_html/publishmedia/yyyymmddhhmmss.jpg - where yyyy=year, mm=month, dd=day etc.

    Is this easy to do with a php script? Running this script on a regular basis would be easy enough via a cron job (I guess?) but for the actual script, I have to admit I don't really have much of an idea (as any regulars who have spotted my posts before will testify ). If someone could point me in the right direction, I would be extremely grateful for the push.

    Thanks to one and all!

  2. #2
    SitePoint Addict
    Join Date
    Aug 2002
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use the rename() function to move files http://php.net/rename


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •