Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Automatically delete files

09 Jan 2012   #1
Bigsplash

Windows 7 Ultimate x64
 
 
Automatically delete files

I am using this program to record TV shows (BeyondTV) and for every recording it creates extra files that are not need. These are the extra filests1.index, ts0.timeindex and ts1.header. I only use the *.td files which are the actual recording.

Is there a way to automatically delete these files?


My System SpecsSystem Spec
.

09 Jan 2012   #2
JimLewandowski

 
 

Create .bat script (and have a desktop icon for it) of something like:

REM execute the BeyondTV executablet
START /WAIT drive:\folder\subfolder\.....\executable.exe (runs the executable but waits/suspends the rest of this .bat from running)

REM point to directory that TV shows are saved in
CD "folderpath" to the directory where these files are save

REM delete unnecessary file
del filests1.index
del ts0.timeindex
ts1.header
My System SpecsSystem Spec
09 Jan 2012   #3
Bigsplash

Windows 7 Ultimate x64
 
 

Thank you Jim for your speedy reply, I am a bit of a noob when it comes to programming, so please have patience with me.

The name of the files will change depending on the name of the Tv show the only thing that is constant would be the file type, *.index, *.timeindex and *.header.

So if I understand correctly I create a text file and rename it to a *.bat file.

In this batch file I will have the following text:

REM execute the BeyondTV executablet
START /WAIT C:\RecordedTV\MyBatchFile.bat (runs the executable but waits/suspends the rest of this .bat from running)

REM point to directory that TV shows are saved in
CD C:\RecordedTV to the directory where these files are save

REM delete unnecessary file
del *.index
del *.timeindex
del *.header


Then I could have task manager run this script every hour, or I could just click a link on the desktop.
My System SpecsSystem Spec
.


09 Jan 2012   #4
JimLewandowski

 
 

Quote   Quote: Originally Posted by Bigsplash View Post
Thank you Jim for your speedy reply, I am a bit of a noob when it comes to programming, so please have patience with me.

The name of the files will change depending on the name of the Tv show the only thing that is constant would be the file type, *.index, *.timeindex and *.header.

So if I understand correctly I create a text file and rename it to a *.bat file.

In this batch file I will have the following text:

REM execute the BeyondTV executablet
START /WAIT C:\RecordedTV\MyBatchFile.bat (runs the executable but waits/suspends the rest of this .bat from running)

REM point to directory that TV shows are saved in
CD C:\RecordedTV to the directory where these files are save

REM delete unnecessary file
del *.index
del *.timeindex
del *.header

Then I could have task manager run this script every hour, or I could just click a link on the desktop.
No need to rename a txt to bat. Start with bat. Edit using notepad. From command line "notepad whateveryourbatiscalled.bat".

The START /WAIT command will point to your .exe file that launches your TV Recorder software (GUI). It does not point to another .bat file.

Your wildcard deletes will work. I believe you'll need a del command with the /Q option (quiet mode, to ignore prompts from wildcard delete).

No need to have task manager run unless you want those files deleted within that hour. Once you exit the application, it would then delete the files. Then again, maybe you leave this app up all the time so the task scheduler would work. No reason to not have that task run with an even short duration. This task would then call the .bat file WITHOUT the START /WAIT part. It would simply CD to the directory and wildcard delete.
My System SpecsSystem Spec
09 Jan 2012   #5
Bigsplash

Windows 7 Ultimate x64
 
 

Hi Jim
Yes i keep the recording program running 24/7.

So then my batch file would look like this?

REM point to directory that TV shows are saved in
CD C:\RecordedTV to the directory where these files are save

REM delete unnecessary file
del/q *.index
del/q *.timeindex
del/q *.header
My System SpecsSystem Spec
09 Jan 2012   #6
JimLewandowski

 
 

Yes. But space between del and /Q.

DEL /Q .......
My System SpecsSystem Spec
11 Jan 2012   #7
Bigsplash

Windows 7 Ultimate x64
 
 

Doesn't work.

Windows will ask whether I am sure if i want to run this software, since the publisher can not be verified?
I click OK, I see the batch file execute, but nothing happens.

This is the content of the delete.bat, this batch file is also in the same folder where it is deleting the files.



del /q *.dat
del /q *.index
del /q *.timeindex
del /q *.header
del /q *.index.dat


My System SpecsSystem Spec
11 Jan 2012   #8
JimLewandowski

 
 

I can't see the photobucket image at work. Post them as regular attachments using the Attachment option on EDIT post (GO ADVANCED option).

You're just running a .bat script via task scheduler every hour. Are going with the solution in the 2nd post with the START /WAIT part??

So, for the task in Task Scheduler do you have it setup to simply run a command:

C:\RecordedTV\MyBatchFile.bat

There is no publisher or anything involved. It's a simple .bat script with some delete commands in it. Do you have the CD C:\RecordedTV\ line in that .bat script? When things run from task scheduler, the default directory is C:\Windows\System32.
My System SpecsSystem Spec
11 Jan 2012   #9
Bigsplash

Windows 7 Ultimate x64
 
 

At this point I am just trying to get the script to work, so I am not using task scheduler, as of yet.

Sorry, don't quite understand the START /WAIT part, like I said I am a noob at this stuff.
My System SpecsSystem Spec
11 Jan 2012   #10
JimLewandowski

 
 

Repeat: your bat script as called via task scheduler OR the CMD line prompt contains:


CD C:\RecordedTV\

del /q *.dat
del /q *.index
del /q *.timeindex
del /q *.header
del /q *.index.dat

From the CMD line or prompt, enter:

C:\RecordedTV\MyBatchFile.bat (or you seem to be testing with one called "delete.bat")


There is no START command in this .bat script as you said RecorderTV runs 24x7 so is virtually never shutdown. So, we decided to simply have the CD and DEL statements in the .bat script.
My System SpecsSystem Spec
Reply

 Automatically delete files




Thread Tools





Similar help and support threads
Thread Forum
why my files are attempting to delete automatically
my laptop's files and folders are attempting to delete automatically when i want to open any file or folder.may be it is caused by a virus.can anybody help me for this issue.
General Discussion
how to delete spam with certain keywords automatically in Yahoo! Mail
hi I've been using this Yahoo! Mail for long long time so I can't change to a new email. I usually get more than 400 spam mail in a week and I have not given away my adddress to untrusted websites or subscriptions for long time and I never click on the email. They are mostly with topics like '...
Browsers & Mail
Recycle Bin - Permanently Delete Items Automatically
Set Recycle Bin to Permanently Delete Items Immediately in Windows The Recycle Bin provides a safety net when deleting files or folders. When you delete any of these items from your hard disk, Windows places it in the Recycle Bin and the Recycle Bin icon changes from empty to full. This...
Tutorials
How to automatically delete/filter images which are smaller than X
As the title says. I need a script or program which can check images inside a folder for their size and delete/filter everything below a certain threshold. by size I mean of course the image dimensions - not the file size. for example - keep only images which are wider than 640 pixels. ...
Software
WMC won't automatically delete shows
I set WMC to only keep a certain number of episodes, (10 or less) then to keep 'Until space needed." However, it keeps recording episodes. For some, I have 30 or more episodes. I have to delete them manually by leaving WMC and doing it through Windows explorer. How do I set WMC to only keep the...
Media Center
automatically delete/move files to folders
hi all! is there something like a handy method to automatically move files depending on their extension to custom folders? (either by the time they are generated or at a specific date). ps: b.) i would be also interested in finding a method to have windows7 delete files in custom folders at a...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 22:13.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App