Job to clean subdirectories

  • Thread starter Thread starter Veets
  • Start date Start date
V

Veets

Hello,
We're running aWindows 2000 domain
I've been asked to create a task on one of my servers that will delete any
subdirectories (within a main directory) that are older than 30 days. By
'older than 30 days', I mean the subdirectory creation date. Also, I've been
asked NOT to delete the default.asp file that is at the root of the
directory. I can't seem to find any built-in commands that will allow me to
do this; the 'Del' command is restricted.Also, the 'rmdir' doesn't have any
advanced options for this type of thing. Any resource kit utilities/3rd part
utilities that will allow me to do this?
TIA
Regards,
Veets
 
Veets said:
Hello,
We're running aWindows 2000 domain
I've been asked to create a task on one of my servers that will delete any
subdirectories (within a main directory) that are older than 30 days.

Sounds dangerous but certainly doable.
(Maybe a backup, or temporary move to elicit
complaints first, is in order.)
By
'older than 30 days', I mean the subdirectory creation date.

Wouldn't the LAST CHANGE date be more appropriate?
Also, I've been
asked NOT to delete the default.asp file that is at the root of the
directory. I can't seem to find any built-in commands that will allow me to
do this; the 'Del' command is restricted.

Restricted how?

It won't do it alone but it can be PART of the solution.
Also, the 'rmdir' doesn't have any
advanced options for this type of thing. Any resource kit utilities/3rd part
utilities that will allow me to do this?

There must be but it is possible with just the included
tools -- Perl for instance would make it much easier but
this isn't installed on all machines (in most networks.)

Basic approach: use a command or script to get the list
of files into a text file.

Loop through each file with Del.

Sometimes it is easiest to just have the script WRITE
the batch file that does the work.

Programs generating programs -- a powerful concept.

I personally have a bunch of "dir-substitute" utilities
but one that I know to be freely avaible in a "Unix
collection for Windows":

http://unxutils.sourceforge.net

Find is in there and there may be others.

You don't have to install any or all of the tools on the
target machines as long as you can reach them across
the network -- you might wish to copy down the
particular tools you need if there is a long batch job
where they will be used repeatedly (and then perhaps
delete when finished.)
 
Windows search will display any file by date, newer or older than the date given. Although it does sound dangerous! As are you sure this person isn't trying to get you fired? As deleting any files older than 30 days sounds like a bad idea to me.

Bill




Date: Mon, 14 Feb 2005 15:00:59 -0600

Veets said:
Hello,
We're running aWindows 2000 domain
I've been asked to create a task on one of my servers that will delete any
subdirectories (within a main directory) that are older than 30 days.

Sounds dangerous but certainly doable.
(Maybe a backup, or temporary move to elicit
complaints first, is in order.)
By
'older than 30 days', I mean the subdirectory creation date.

Wouldn't the LAST CHANGE date be more appropriate?
Also, I've been
asked NOT to delete the default.asp file that is at the root of the
directory. I can't seem to find any built-in commands that will allow me to
do this; the 'Del' command is restricted.

Restricted how?

It won't do it alone but it can be PART of the solution.
Also, the 'rmdir' doesn't have any
advanced options for this type of thing. Any resource kit utilities/3rd part
utilities that will allow me to do this?

There must be but it is possible with just the included
tools -- Perl for instance would make it much easier but
this isn't installed on all machines (in most networks.)

Basic approach: use a command or script to get the list
of files into a text file.

Loop through each file with Del.

Sometimes it is easiest to just have the script WRITE
the batch file that does the work.

Programs generating programs -- a powerful concept.

I personally have a bunch of "dir-substitute" utilities
but one that I know to be freely avaible in a "Unix
collection for Windows":

http://unxutils.sourceforge.net

Find is in there and there may be others.

You don't have to install any or all of the tools on the
target machines as long as you can reach them across
the network -- you might wish to copy down the
particular tools you need if there is a long batch job
where they will be used repeatedly (and then perhaps
delete when finished.)
 
Windows search will display any file by date, newer or older than the date
given. Although it does sound dangerous! As are you sure this person isn't
trying to get you fired? As deleting any files older than 30 days sounds
like a bad idea to me.


Me too, but Windows search doesn't work that
well for subdirectories etc (last I checked but
then I seldom use it.)

--
Herb Martin



Bill




Date: Mon, 14 Feb 2005 15:00:59 -0600

Veets said:
Hello,
We're running aWindows 2000 domain
I've been asked to create a task on one of my servers that will delete any
subdirectories (within a main directory) that are older than 30 days.

Sounds dangerous but certainly doable.
(Maybe a backup, or temporary move to elicit
complaints first, is in order.)
By
'older than 30 days', I mean the subdirectory creation date.

Wouldn't the LAST CHANGE date be more appropriate?
Also, I've been
asked NOT to delete the default.asp file that is at the root of the
directory. I can't seem to find any built-in commands that will allow me to
do this; the 'Del' command is restricted.

Restricted how?

It won't do it alone but it can be PART of the solution.
Also, the 'rmdir' doesn't have any
advanced options for this type of thing. Any resource kit utilities/3rd part
utilities that will allow me to do this?

There must be but it is possible with just the included
tools -- Perl for instance would make it much easier but
this isn't installed on all machines (in most networks.)

Basic approach: use a command or script to get the list
of files into a text file.

Loop through each file with Del.

Sometimes it is easiest to just have the script WRITE
the batch file that does the work.

Programs generating programs -- a powerful concept.

I personally have a bunch of "dir-substitute" utilities
but one that I know to be freely avaible in a "Unix
collection for Windows":

http://unxutils.sourceforge.net

Find is in there and there may be others.

You don't have to install any or all of the tools on the
target machines as long as you can reach them across
the network -- you might wish to copy down the
particular tools you need if there is a long batch job
where they will be used repeatedly (and then perhaps
delete when finished.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top