Skip to main content
Known Participant
May 31, 2009
Question

unzip and rename folder

  • May 31, 2009
  • 1 reply
  • 495 views

Hi,


I need to upload a zip file to create a contstant file structure like the one below

-images

     -thumbs

the problem is if the user is zipping uploading the zip (myfiles1.zip ) and even if I rename the zip to images.zip and then unzip the folder it is still called myfiles1.

Is there a way to deal with parent and root folders in Coldfusion? If not is there a way to uplaod any zip file and rename the parent to 'images'

Many Thanks,

H.

    This topic has been closed for replies.

    1 reply

    HulfyAuthor
    Known Participant
    June 2, 2009

    In answer to me own question I did some string manipluation removed the zip and renamed the folder.

    <cfset folderName = Replace(#File.ServerFile#, ".zip", "")>
        <cffile action = "rename" source = "#ExpandPath("../clients/#clientID#/#folderName#")#" destination = "#ExpandPath("../clients/#clientID#/images")#" mode = "777" >