Jump to content

Delete certain file format using a script


Recommended Posts

Posted

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...

Posted

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

 

Something like:

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...