Filesystem Object Question

Results 1 to 7 of 7

Thread: Filesystem Object Question

  1. #1

    Default Filesystem Object Question

    Hey guys,<BR><BR>How can I place a folder within a folder without receiving the error message..."file already exists".<BR><BR>Heres my code...<BR><BR>set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR>If Not objFSO.FolderExists(Server.MapPath(strPath) & "\" & session("type") & "\" & session("subject")) then<BR>objFSO.CreateFolder Server.MapPath(strPath) & "\" & session("type") & "\" & session("subject")<BR>else<BR>&#039;LET ME KNOW!<BR><BR>The thing is...the type is determined via a dropdown menu within a form. (I wanted to make a special effort in terms of file/folder management, so that things are organised on the server)<BR><BR>But the problem im faced with is that the parent folders already exist. Hence the session("type") ...<BR><BR>Any suggestions?<BR><BR>Cheers,<BR>John

  2. #2
    Join Date
    Dec 1969

    Default You've got me...

    I might suggest that you rewrite a bit, but I dunno why it doesn&#039;t work.<BR><BR>&#060;%<BR>set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>path = Server.MapPath(strPath & "/" & session("type") & "/" & session("subject"))<BR><BR>If Not objFSO.FolderExists(path) then<BR> Response.Write "DEBUG: path does *NOT* exist: " & path & "&#060;HR&#062;"<BR> objFSO.CreateFolder path<BR>else<BR> Response.Write "DEBUG: path *DOES* exist: " & path & "&#060;HR&#062;"<BR>End If<BR>...<BR>%&#062;<BR><BR>

  3. #3

    Default Bill...

    the code actually works a treat...<BR><BR>the problem is that each folder is already exists. I just want to ensure the correct placement of each new folder within its parent folder. Im doing this via a dropdown on the form. I didnt want one folder with everything dumped straight in.<BR><BR>Heres an example...<BR><BR>I have a folder called "articles". Within this folder I have a number of folders such as...<BR><BR>Audio Visual<BR>General Support<BR>Hardware<BR>Software<BR>Networking<BR>T raining<BR><BR>etc etc etc...<BR><BR>Now when the user completes the form they are actually choosing from a dropdown that lists these folders. When they write their file, I want it to be placed within the correct folder.<BR><BR>Understand?<BR><BR>John

  4. #4
    Join Date
    Dec 1969

    Default Confusing the hell out of me...

    First you say:<BR> "each folder is [sic] already exists."<BR>Then you turn right around and say:<BR> "correct placement of each new folder within its parent folder."<BR><BR>If each folder already exists, then why do you need to do any "placement" at all????<BR><BR>**********<BR><BR>On top of that, if you are getting the sub-folder from a drop-down list (a &#060;SELECT&#062;, I presume you mean), then why are you doing:<BR> path = Server.MapPath(strPath & "/" & session("type") & "/" & session("subject")) <BR><BR>Why aren&#039;t you using something like<BR> path = Server.MapPath(strPath & "/" & session("type") & "/" & Request("subFolder") )<BR><BR>*********<BR><BR>And what does placing the user&#039;s file into the correct folder have to do with the need to create the folders and subfolders (except indirectly)???<BR><BR>***********<BR><BR>Probably won&#039;t see your answer. 5 minutes to bed time.<BR><BR><BR>

  5. #5

    Default solution....

    dump em all into one folder...!!<BR><BR>BUGGER IT!

  6. #6
    Join Date
    Dec 1969

    Default So is sulfuric acid...

    ...but it&#039;s not a solution I like.<BR><BR>Oh, well... off to bed.<BR><BR>

  7. #7

    Default nitey nite Billy Boy! <eom>


Posting Permissions

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