Deleting files using ASP

Results 1 to 3 of 3

Thread: Deleting files using ASP

  1. #1
    Join Date
    Dec 1969
    Posts
    613

    Default Deleting files using ASP

    How can I use ASP (VBScript) to delete files in a directory? As an extension of directory browsing, for example.

  2. #2
    Join Date
    Dec 1969
    Posts
    308

    Default RE: Deleting files using ASP

    Use the file system object like this: <BR><BR> &#060;% Set file = Server.CreateObject("Scripting.FileSystemObject") %&#062;<BR> &#060;% Set myfile = file.GetFile("d:mydirectorymyfile.asp %&#062;<BR> &#060;% myfile.delete %&#062;

  3. #3
    Join Date
    Dec 1969
    Posts
    138

    Default RE: Deleting files using ASP

    I had difficulty with that method, I ended up using something like this:<BR><BR>Set file = Server.CreateObject("Scripting.FileSystemObject")< BR>tempname = "C:wwwrootmyfile.jpg"<BR>file.DeleteFile(tempname) <BR><BR>It&#039s almost the same except for DeleteFile vs. Delete.

Posting Permissions

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