<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Посчитать количество файлов и удалить если из больше 7]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10881&amp;type=atom" />
	<updated>2015-08-21T04:21:46Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10881</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Посчитать количество файлов и удалить если из больше 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96684#p96684" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>yara10202 пишет:</cite><blockquote><p>написал скрипт но не могу понять в чем ошибка, кто может подсказать?<br /></p><div class="codebox"><pre><code>
On Error Resume Next

del7dir(&quot;C:\Users\1\Desktop\Backup\day\&quot;)

Function del7dir(day)
set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)&#039; создание объекта FSO
if FSO.FolderExists(day) then&#039; если папка существует
if FSO.GetFolder(day).Files.Count &gt;7 then&#039; если файлов в папке &gt; = 0
Set oDirs = FSO.GetFolder(day)
Set oFiles = oDirs.Files
Set oSubFolders = oDirs.SubFolders
For Each oFile In oFiles
If DateDiff(&quot;d&quot;, oFile.DateCreated, Now) &gt; 7 then&#039; если с момента создания файла прошло более 1 дней
oFile.Delete
End If
Next
End if
End if
End Function</code></pre></div></blockquote></div><p>разобрался просто надо было вместо oFile.DateCreated поставить oFile.DateLastModified и все стало работать стабильно</p>]]></content>
			<author>
				<name><![CDATA[yara10202]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33289</uri>
			</author>
			<updated>2015-08-21T04:21:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96684#p96684</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Посчитать количество файлов и удалить если из больше 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96683#p96683" />
			<content type="html"><![CDATA[<p>написал скрипт но не могу понять в чем ошибка, кто может подсказать?<br /></p><div class="codebox"><pre><code>
On Error Resume Next

del7dir(&quot;C:\Users\1\Desktop\Backup\day\&quot;)

Function del7dir(day)
set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)&#039; создание объекта FSO
if FSO.FolderExists(day) then&#039; если папка существует
if FSO.GetFolder(day).Files.Count &gt;7 then&#039; если файлов в папке &gt; = 0
Set oDirs = FSO.GetFolder(day)
Set oFiles = oDirs.Files
Set oSubFolders = oDirs.SubFolders
For Each oFile In oFiles
If DateDiff(&quot;d&quot;, oFile.DateCreated, Now) &gt; 7 then&#039; если с момента создания файла прошло более 1 дней
oFile.Delete
End If
Next
End if
End if
End Function</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yara10202]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33289</uri>
			</author>
			<updated>2015-08-21T03:46:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96683#p96683</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Посчитать количество файлов и удалить если из больше 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96618#p96618" />
			<content type="html"><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?pid=44441#p44441">Исправляйтесь</a>.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-08-19T07:31:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96618#p96618</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: Посчитать количество файлов и удалить если из больше 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96616#p96616" />
			<content type="html"><![CDATA[<p>Пользовался поиском нашел простой подсчет с выводом сколько файлов в папке<br />как написать функцию если файлов в папке больше 7 удалить файлы созданные/измененные больше 7дней назад</p>]]></content>
			<author>
				<name><![CDATA[yara10202]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33289</uri>
			</author>
			<updated>2015-08-19T06:35:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96616#p96616</id>
		</entry>
</feed>
