Computing.Net > Forums > Windows XP > batch job

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch job

Reply to Message Icon

Name: myguess21
Date: July 15, 2008 at 03:58:07 Pacific
OS: Windows
CPU/Ram: 2003
Product: 2003
Comment:

Hi,

How can I delete files which are older then 15 days from a directory using a batch job.
Resource kit is not installed on my machine.

Thank you.

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 15, 2008 at 04:14:38 Pacific
Reply:

If you read the last several dozen threads on the subject of 'date math' you'll see that it's not a happy subject.


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: myguess21
Date: July 15, 2008 at 04:37:05 Pacific
Reply:

I search some posts I didn't find the complete solution so no one has figured it out yet.

second, is there a way to XCOPY by date or last 5 or 10 files. other work short by date/time and copy to another folder.

Thanks


0

Response Number 3
Name: Mechanix2Go
Date: July 15, 2008 at 05:10:02 Pacific
Reply:

You can COPY [ or DEL or MOVE] the most recent files. This code keeps the 10 newest.

::=====================
@echo off

FOR /F "skip=10 delims=" %%a IN ('DIR /b /o-d /a-d') DO (
echo DEL %%a
)


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: myguess21
Date: July 15, 2008 at 06:26:29 Pacific
Reply:

I am getting error:

%%a was unexpected at this time.

am i missing anyting?

Thanks


0

Response Number 5
Name: myguess21
Date: July 15, 2008 at 06:34:56 Pacific
Reply:

I fix the error by %%a to %a

thank you for you help.

Thanks


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: batch job

Schedules, Batch Jobs, and ROBOCOPY www.computing.net/answers/windows-xp/schedules-batch-jobs-and-robocopy/89471.html

copy and replace via batch file www.computing.net/answers/windows-xp/copy-and-replace-via-batch-file/146642.html

Counters with FOR in Batch Files www.computing.net/answers/windows-xp/counters-with-for-in-batch-files/165116.html