remove files by date (every two weeks)

Microsoft Windows server 2008 r2 standar...
November 16, 2010 at 09:25:46
Specs: Windows 2008, 4ghz/128gb
I need a script that will clean out all files older than 2 weeks in my d:ftp directory. I will schedule it to run every night, can anyone help?

Thank you,

Leto the just


See More: remove files by date (every two weeks)

Report •


#1
November 16, 2010 at 12:32:22
Hi Carl

Im not familar with Windows 2008 ,but I written a batch file to calulate dates and the
age of files, which works fine on WinXP and in Win7.
Doe's Win 2008 suport the "for /f" and the "Set /a" commands in the Dos Prompt.

As Im english my date format is dd/mm/yyyyy so the program I will have to modified it.

What do these cammands produce on your system.

echo %Date%
for %%a in (*.log) do (echo %%~ta)


Report •

#2
November 16, 2010 at 15:29:13
C:\>echo %Date%
Tue 11/16/2010

C:\>for %%a in (*.log) do (echo %%~ta)
%%a was unexpected at this time.

Thank you,

Leto the just


Report •

#3
November 16, 2010 at 16:27:44
Hi Carl

Sorry about that was supposed to be .

for %a in (*.log) do (echo %%~ta)


Report •

Related Solutions

#4
November 16, 2010 at 16:52:57
C:\>for %a in (*.log) do (echo %%~ta)

C:\>

Nothing was returned.

Thank you,

Leto the just


Report •

#5
November 17, 2010 at 09:52:20
Hi Carl
I think my brain must be out of gear, but it was late.
Try this

@echo off
d:
for %a in (d::\ftp\*.*) do (echo %~ta)



Report •

#6
November 30, 2010 at 08:15:44
Still no output.


C:\Users\Administrator>cd\

C:\>@echo off
d:
for %a in (d::\ftp\*.*) do (echo %~ta)

Thank you,

Leto the just


Report •


Ask Question