Author Topic: Need a Windows based solution for a certain problem.
NuEM 
Posts: 15,394
Registered: Mar 2, '04
Extended Info (if available)
Real Post Cnt: 13,662
User ID: 900,449
Subject: Need a Windows based solution for a certain problem.
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-----
It's time we became European:
http://www.youtube.com/watch?v=6VzdZ1i8YM8
The Federalist's Song:
http://www.youtube.com/watch?v=lz70fFZHEhw
Link to this post
Ptilk 
Title: Creepy old pirate
Posts: 50,658
Registered: Feb 13, '02
Extended Info (if available)
Real Post Cnt: 48,530
User ID: 645,124
Subject: Need a Windows based solution for a certain problem.
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.

 

-----signature-----
(none)
Link to this post
RHWarrior 
Posts: 5,026
Registered: Sep 30, '09
Extended Info (if available)
Real Post Cnt: 5,021
User ID: 1,372,077
Subject: Need a Windows based solution for a certain problem.
Are you trying to set up a script to prune old porn downloads?
Hmm?

grin

 

-----signature-----
"Drink coffee - do stupids things faster with more energy! ...and I'm all out of beans..." -me
"You guys need to stop dick riding wow and compare everything to it. It never invented a godamn thing, just made it popular. " -tinkly
Link to this post
NuEM 
Posts: 15,394
Registered: Mar 2, '04
Extended Info (if available)
Real Post Cnt: 13,662
User ID: 900,449
Subject: Need a Windows based solution for a certain problem.
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?

grin


My old porn downloads are sacred!

 

-----signature-----
It's time we became European:
http://www.youtube.com/watch?v=6VzdZ1i8YM8
The Federalist's Song:
http://www.youtube.com/watch?v=lz70fFZHEhw
Link to this post
Ptilk 
Title: Creepy old pirate
Posts: 50,658
Registered: Feb 13, '02
Extended Info (if available)
Real Post Cnt: 48,530
User ID: 645,124
Subject: Need a Windows based solution for a certain problem.
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.

 

-----signature-----
(none)
Link to this post
Taliesihne 
Title: Wind on the Deep Waters
Posts: 36,223
Registered: Feb 19, '04
Extended Info (if available)
Real Post Cnt: 30,592
User ID: 896,469
Subject: Need a Windows based solution for a certain problem.
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
Link to this post
Abaddon_Ambrosius 
Title: Retired Theurgist TL
Posts: 25,187
Registered: Dec 21, '01
Extended Info (if available)
Real Post Cnt: 25,057
User ID: 568,022
Subject: Need a Windows based solution for a certain problem.
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
Link to this post
NuEM 
Posts: 15,394
Registered: Mar 2, '04
Extended Info (if available)
Real Post Cnt: 13,662
User ID: 900,449
Subject: Need a Windows based solution for a certain problem.
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-----
It's time we became European:
http://www.youtube.com/watch?v=6VzdZ1i8YM8
The Federalist's Song:
http://www.youtube.com/watch?v=lz70fFZHEhw
Link to this post
Crooq_Lionfang 
Title: Master Zergling
Posts: 14,555
Registered: Mar 11, '03
Extended Info (if available)
Real Post Cnt: 13,354
User ID: 778,501
Subject: Need a Windows based solution for a certain problem.
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

Link to this post

Valid XHTML 1.0 Transitional Powered by PHP