🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.os.windowsxp
Article #119728

Re: [BAT] Usuwanie tylko starych plikow

#119728
From: Tomasz
Date: Mon, 26 May 2008 04:38
53 lines
2352 bytes
Użytkownik "Piotr Kuliński" <piotr_kulinski@wpw.pl> napisał
> 'Tu pełniejszy skrypt
>
> ' Kuliński Piotr, kasowanie plików na lokalnym komputerze z określonego 
> folderu
> ' gdzie data jest mniejsza od aktualnej
>
> strComputer = "."
> strPath="d:\temp"
>
> Set objWMIService = 
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & 
> "\root\cimv2")
> Set colItems = objWMIService.ExecQuery("Select * from Win32_UTCTime")
> For Each objItem in colItems
>
> dt_del=objItem.Year&"-"&right("0"&objItem.Month,2)&"-"&right("0"&objItem.Day,2)
> Next
>
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
>
> Set objShell = CreateObject ("Shell.Application")
> Set objFolder = objShell.Namespace (strPath)
> Set objFSO = CreateObject("Scripting.FileSystemObject")
>
> For Each strFileName in objFolder.Items
>     if (objFolder.GetDetailsOf (strFileName, 4) < (dt_del&" 00:00")) then
>        wscript.echo objFolder.GetDetailsOf (strFileName, 4)&" --> " & 
> strPath&"\"&strFileName
>        objFSO.DeleteFile(strPath&"\"&strFileName)
>     end if
> Next


Hej

Do czego służy ta część kodu?:

'-----------
Set objWMIService = ...
Set colItems = ...

For Each objItem in colItems
   dt_del=objItem.Year&"-"&right("0"&objItem.Month,2)&"-"&right("0"&objItem.Day,2)
Next
'-----------



-- 
Pozdrawiam
-Tomek- 
Technical Details
Message-ID: <g1deu1$n7p$1@news2.task.gda.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.task.gda.pl!not-for-mail
References: <g10hpf$1sk$1@news2.task.gda.pl> <g11iti$42a$1@inews.gazeta.pl> <g11nom$83d$1@inews.gazeta.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.task.gda.pl!not-for-mail
From: "Tomasz" <wytnij@wp.pl>
Newsgroups: alt.pl.comp.os.windowsxp
Subject: Re: [BAT] Usuwanie tylko starych plikow
Date: Mon, 26 May 2008 06:38:37 +0200
Organization: CI TASK http://www.task.gda.pl/
Lines: 54
Message-ID: <g1deu1$n7p$1@news2.task.gda.pl>
References: <g10hpf$1sk$1@news2.task.gda.pl> <g11iti$42a$1@inews.gazeta.pl> <g11nom$83d$1@inews.gazeta.pl>
NNTP-Posting-Host: adty84.neoplus.adsl.tpnet.pl
Mime-Version: 1.0
X-Trace: news2.task.gda.pl 1211776769 23801 79.185.236.84 (26 May 2008 04:39:29 GMT)
X-Complaints-To: abuse@news.task.gda.pl
NNTP-Posting-Date: Mon, 26 May 2008 04:39:29 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit