Deleting files and write deleted file names to a text document

Answered Deleting files and write deleted file names to a text document

  • Wednesday, December 12, 2012 4:37 PM
     
     

    Hello,

    I am sure it can be done but dont know the syntax or commands to use. I have a script that is deleting files from a specific desktop which works, but I want to capture the names of the files I am deleting and write them to a log file that is created while the script runs. If needed I can post the script, but really I am just wondering about the one part.

    Thanks.

All Replies

  • Wednesday, December 12, 2012 4:43 PM
    Moderator
     
     

    You neglected to mention what language your script is written in.

    Bill

  • Wednesday, December 12, 2012 4:44 PM
     
     

    Absolutly right, sorry. I am writing vbs.

  • Wednesday, December 12, 2012 4:49 PM
    Moderator
     
     Answered

    In this case, you could use the FileSystemObject object and its methods to:

    1) Create an output text file using the TextStream object

    2) Write each file's name to the output file before deleting it

    3) Close the output file

    Bill

    • Marked As Answer by RCCMG Wednesday, December 12, 2012 5:00 PM
    •  
  • Wednesday, December 12, 2012 5:00 PM
     
     

    Thanks that helped a lot and now it is writing the the logfile I am already creating.