event to clear a directory

Results 1 to 2 of 2

Thread: event to clear a directory

  1. #1
    Rob Guest

    Default event to clear a directory

    Does anyone know how to write an event to clear a directory<BR>holding files that are unneeded?<BR><BR>Rob

  2. #2
    Jason Buck Guest

    Default RE: event to clear a directory

    I use this to delete files from my users temporary directory when they log out of my site.<BR><BR><BR>&#060;%<BR>&#039**This is the path to the directory where the files are stored<BR>&#039**This code will delete all files in a directory.<BR>dirtodelete1 = "C:inetdocs\" & strLogin6 & "\"<BR><BR>Set fs1 = CreateObject("Scripting.FileSystemObject")<BR>Set f1 = fs1.GetFolder(dirtodelete1)<BR>set fc1 = f1.Files<BR><BR>For Each anyfile1 in fc1<BR>Dim strDelete1<BR>strDelete1 = dirtodelete1 & anyfile1.name<BR><BR> Dim fso1, MyFile1<BR> set fso1 = CreateObject("Scripting.FileSystemObject")<BR> set MyFile1 = fso1.GetFile(strDelete1)<BR> MyFile1.Delete<BR>Next<BR><BR>%&#062;<BR><BR>I hope this helps. If not feel free to contact me.<BR><BR>Respectfully,<BR><BR>Jason<BR>webmaster @wnj.com

Posting Permissions

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