VaultNetwork.net Vault Network Boards
Author Topic: Need a Windows based solution for a certain problem. [Locked]
NuEM  4 stars
Posts: 1,007
Registered: 2004-3-2 09:08:11
I need a Windows tool or script that lets me delete all folders that haven't been touched in x time. Specifically: If there is at least one file in this folder or any of its sub-folders that is "younger" than x, the folder must not be deleted. But all folders that don't have a file "younger" than x inside them or any of their sub-folders should be deleted.

Problem here is that the file system doesn't seem to propagate "last modified" to the parent folder, so simply using "last modified" on the top level folders doesn't help me.

Any ideas?

 

-----signature-----
Ptilk  4 stars
Title: Creepy old pirate
Posts: 2,359
Registered: 2002-2-13 14:52:58
Not sure if it is what you are looking for, but "forfiles" is still available in the Microcrap tech database and it could be set to delete (or archive) any files older than a certain date, or not accessed since a certain date on older windows machines.

Not sure if it works on Windows 7 machines (or whatever the latest version is these days)....but it works on Unix machines and on WinXP and Server 2003.
RHWarrior  3 stars
Posts: 770
Registered: 2009-9-30 18:42:12
Are you trying to set up a script to prune old porn downloads?
Hmm?

 

-----signature-----
"Drink coffee - do stupids things faster with more energy! ...and I'm all out of beans..." -me
"ou guys need to stop dick riding wow and compare everything to it. It never invented a godamn thing, just made it popular. " -tinkly
NuEM  4 stars
Posts: 1,007
Registered: 2004-3-2 09:08:11
Ptilk posted:

Not sure if it is what you are looking for, but "forfiles" is still available in the Microcrap tech database and it could be set to delete (or archive) any files older than a certain date, or not accessed since a certain date on older windows machines.

Not sure if it works on Windows 7 machines (or whatever the latest version is these days)....but it works on Unix machines and on WinXP and Server 2003.



Thanks, but I have already played around with forfiles a bit and there is at least no trivial way to let it do what I want. The problem is that I don't want to look at individual files, but keep the folder integrity intact. Either remove the whole folder because all files in it and its subfolders are older than x, or don't remove the folder and any of its files at all. But forfiles only lets me run commands on individual files losing the structure in which they are stored.


RHWarrior posted:

Are you trying to set up a script to prune old porn downloads?
Hmm?





My old porn downloads are sacred!

 

-----signature-----
Ptilk  4 stars
Title: Creepy old pirate
Posts: 2,359
Registered: 2002-2-13 14:52:58
Not a clue then. I bet google knows the answer, just have to know how to ask the question, that's always the tricky part. Good luck.
Taliesihne  4 stars
Title: Wind on the Deep Waters
Posts: 1,117
Registered: 2004-2-19 04:47:59
I will preface this by saying that because I am a hammer, everything looks like a nail to me....

I would write a quick and dirty C# app to do this. .NET has a DirectoryInfo Class that includes a LastAccessTime Property. Setting up the code to loop through directories and delete based on this property is not difficult.

A few quick decisions on UI implementation and I could have this coded in a weekend (more like a day tbh.)

Ps - I believe Visual C# Express is all you would need to write the app.

 

-----signature-----
Jesus saves, Allah protects, and Cthulhu thinks you'd make a nice sandwich
First comes smiles, then lies. Last is gunfire. -Roland Deschain, of Gilead
Abaddon_Ambrosius  4 stars
Title: Retired Theurgist TL
Posts: 1,674
Registered: 2001-12-21 09:51:39
You could hire some child labor in Malaysia to remote access your PC and maintain your files for just pennies a month...

 

-----signature-----
In the immortal words of Socrates - "I drank what?"
"God you guys suck at the internet - how can you fail to locate porn?!" - Eternal_Midnight
"Knowing means nothing." - Fat-badger
NuEM  4 stars
Posts: 1,007
Registered: 2004-3-2 09:08:11
Taliesihne posted:

I will preface this by saying that because I am a hammer, everything looks like a nail to me....

I would write a quick and dirty C# app to do this. .NET has a DirectoryInfo Class that includes a LastAccessTime Property. Setting up the code to loop through directories and delete based on this property is not difficult.

A few quick decisions on UI implementation and I could have this coded in a weekend (more like a day tbh.)

Ps - I believe Visual C# Express is all you would need to write the app.



Thanks, but I'm sure someone already done this somewhere. If only I could find it.

 

-----signature-----
Crooq_Lionfang  1 star
Title: Master Zergling
Posts: 185
Registered: 2003-3-11 11:53:17
Syntax Error: unable to process "Windows" and "Solution" in same entry

 

-----signature-----
If you have one foot in tomorrow and one foot in yesterday all you're going to do is piss on today

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.