PDA

View Full Version : geeks, help me delete files automatically



Shade-of-Grey
Sep 25th, 2008, 04:11 AM
can anyone think of a way to do this...maybe with a script or some such?

basically I have a computer set up to do nothing but host ventrilo and download TV shows using miro. Since miro doesnt automatically delete the shows it downloads unless i watch them ON miro, which i dont (i stream them to my xbox), they're just building up and i'm having to delete them automatically

my folder structure looks like this

\Miro\Lost\LostS03E14.avi , Lost S03E13.avi
\Miro\Heroes\HeroesS03E01.avi

etc etc.

Basically I want something to be able to automatically delete a file after it's been there for about a week.

Koobazaur
Sep 25th, 2008, 04:42 AM
Well you can make a batch file with something like

delete path/to/your/folder/*.*

and run it manually / put in your Autostart. As for automating that, look at some online task scheduling programs (wait doesn't windows have that already?) and simply hook up the batch file to that.

Shade-of-Grey
Sep 25th, 2008, 05:13 AM
yeah i could automate it with task scheduler

but i have very little idea of how to write a batch script

and i dont want to have to make a seperate one for every single shows' folder, just one for the Miro folder

Faceman
Sep 25th, 2008, 06:09 AM
Google it. They are very easy to write.

Koobazaur
Sep 25th, 2008, 06:10 AM
batch files are text files with dos commands in it and the extension .bat

so open notepad, put in:
delete path/to/your/folder/*.*

where the path is to the miro folder

and save as "mylittlepony.bat" and run it; it will delete everything in the miro folder

or am I not understating what you want?

edit: the command you may need is deltree since miro may have sub folders which delete won't remove. you may also need to put deltree -r path/to/bla to make it recursive. as face said, google dos delete/deltree, it's really simple

Cheeto
Sep 25th, 2008, 02:05 PM
It would help to know what OS this is.

If it's Windows there's almost certainly a freebie utility out there somewhere, but failing that you could do like they say and just do up a batch file and have it run automagically with the built in scheduler.

If it's Linux/Unix you would write a bash script and have it tied to a cron job.

Maxey
Sep 25th, 2008, 03:09 PM
Shift+Delete

Lithium
Sep 25th, 2008, 03:34 PM
Shift+Delete

FUCKING POST SUCKS
\
http://www.picamatic.com/show/2008/09/25/07/13/1077458_319x319.jpg

Burris
Sep 25th, 2008, 03:38 PM
Oh my god, too much Bill O'Reilly flipping out, not enough reps.

Shade-of-Grey
Sep 25th, 2008, 10:15 PM
1) its windows vista

2) i tried googling it and i couldnt figure it out

3) i dont want to delete all the files, just to delete files after a certain amount of time of existance. so for instance i'd want to delete show 1 that has been there for 7 days, but not show 2 which has only been there 3 days.

Koobazaur
Sep 26th, 2008, 05:28 AM
Well sounds like you need a specific utlitity for that. I can code one for you.




if you pay me.





I accept cash, credit and cock.

Cheeto
Sep 26th, 2008, 01:23 PM
Well sounds like you need a specific utlitity for that. I can code one for you.

if you pay me.

I accept cash, credit and cock.
All in the same slot?

Shade-of-Grey
Sep 27th, 2008, 02:07 AM
i found this:



Dim i, fso, f, f1, sf, BasePath, CalcResult, fNameArray()
BasePath = "D:\Reports"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(BasePath)
Set sf = f.SubFolders
For Each f1 in sf
CalcResult = DateDiff("d",f1.DateCreated,Now)
if CalcResult > 2 then
ReDim preserve fNameArray(i)
fNameArray(i) = f1.Name
i = i + 1
end if
Next

For Each fName in fNameArray
FSO.DeleteFolder(BasePath & "\" & fName)
Next

it doesnt look like it would be exactly what i'm looking for, but does anyone know how to alter this so it is?