+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, Delete certain file format using a script in Coding and Web Development; Hi how would I produce a script that would delete all .txt & .log files from a particular location please? ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,373
    Thank Post
    906
    Thanked 1,811 Times in 1,559 Posts
    Blog Entries
    12
    Rep Power
    468

    Delete certain file format using a script

    Hi how would I produce a script that would delete all .txt & .log files from a particular location please?

    Thanks

  2. #2

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,249
    Thank Post
    1,061
    Thanked 1,070 Times in 626 Posts
    Rep Power
    741

    Re: Delete certain file format using a script

    Same as before - use VB script / AutoIT, or batch commands, type in Del /? on a command line to find out more.
    If the txt and log files are all over the place then a simpe dir *.txt or dir *.log and pipe them to a file - eg:

    dir*.txt /s>c:\textfiles.txt

    Open up the text file in excel, stick in del on every line [ after moving the cells to the right ] - save it as a cmd file and run it and bob's your uncle.....

    I would suggest you also look at powershell...

  3. #3

    Join Date
    Mar 2006
    Posts
    537
    Thank Post
    2
    Thanked 3 Times in 2 Posts
    Rep Power
    19

    Re: Delete certain file format using a script

    In VBS you would have to check all the files of a folder to see if the extension was txt or log

    Something like:
    Code:
    For Each File in Folder.Files
         if   UCASE(File.Extension) = "TXT"  or UCASE(File.Extension)="LOG"
              File.delete
         endif
    Next
    It'd probably easier to do it as a batch file.

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,373
    Thank Post
    906
    Thanked 1,811 Times in 1,559 Posts
    Blog Entries
    12
    Rep Power
    468

    Re: Delete certain file format using a script

    Cheers guys!



SHARE:
+ Post New Thread

Similar Threads

  1. Converting VHS videos to either DVD or file format
    By ctbjs in forum How do you do....it?
    Replies: 8
    Last Post: 17th May 2013, 11:38 PM
  2. need a script to delete shortcuts
    By philtomo-25 in forum Scripts
    Replies: 2
    Last Post: 1st November 2007, 04:50 PM
  3. Office 2007 file format support in Apache, PHP and Moodle
    By Geoff in forum Virtual Learning Platforms
    Replies: 2
    Last Post: 8th July 2007, 01:12 AM
  4. ical file format to csv convert
    By russdev in forum Windows
    Replies: 2
    Last Post: 1st November 2006, 07:22 AM
  5. Replies: 4
    Last Post: 23rd March 2006, 07:27 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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