<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: не получается логическое И]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7991&amp;type=atom" />
	<updated>2013-01-29T18:10:18Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7991</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68980#p68980" />
			<content type="html"><![CDATA[<p>Спасибо за подсказки, все получилось.</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2013-01-29T18:10:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68980#p68980</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68789#p68789" />
			<content type="html"><![CDATA[<p>Естественно! Как я понимаю 27-я строка это <em>FileSize2 = objFSO.GetFile(FilePath).Size</em>. Ты пытаешься узнать размер файла, даже не проверив его существование. А только следующей строкой <em>If objFSO.FileExists(FilePath) And ...</em> проверяешь его существование. Рекомендую поменять их последовательность местами.</p>]]></content>
			<author>
				<name><![CDATA[Lucky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25698</uri>
			</author>
			<updated>2013-01-22T18:19:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68789#p68789</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68788#p68788" />
			<content type="html"><![CDATA[<p>чето стала выскакивать такая ошибка:<br />---------------------------<br />Windows Script Host<br />---------------------------<br />Сценарий:сортировка2.vbs<br />Строка:	27<br />Символ:	9<br />Ошибка:	Файл не найден<br />Код:	800A0035<br />Источник: 	Ошибка выполнения Microsoft VBScript</p><p>---------------------------<br />ОК&nbsp; &nbsp;<br />---------------------------</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2013-01-22T17:52:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68788#p68788</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68767#p68767" />
			<content type="html"><![CDATA[<p>Поменять<br />FileSize2 = objFSO.BuildPath(ResFolderPath,File.Size)<br />на<br />FileSize2 = objFSO.GetFile(FilePath).Size</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2013-01-21T19:34:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68767#p68767</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68760#p68760" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
&#039;сортировка файлов по исходным папкам
&#039; если в папке output есть этот файл и он больше копируемого

Option Explicit
Const SrcFolderPath = &quot;D:\output\&quot;    &#039;куда копируем где исходные файлы
Const ResFolderPath = &quot;D:\input\&quot;   &#039;откуда копируем где обработанные файлы
 
Dim objFSO, TextStream, Folder, SubFolder, File, FilePath, FileSize2
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set TextStream = objFSO.OpenTextFile(&quot;log.txt&quot;,8,True)
 
TextStream.WriteLine &quot;----- &quot; &amp; Now &amp; &quot; -----&quot;
 
RecursiveFolderScan SrcFolderPath
 
MsgBox &quot;Обработка завершена&quot;,vbInformation
 
&#039;Создаём процедуру рекурсивного обхода каталога
Sub RecursiveFolderScan(FolderPath)
    &#039;Получаем объектную модель текущего каталога
    Set Folder = objFSO.GetFolder(FolderPath)
 
    &#039;Перебираем все файлы в текущем каталоге
    For Each File in Folder.Files
        &#039;Проверяем существование аналогичного файла в результирующем каталоге
        FilePath = objFSO.BuildPath(ResFolderPath,File.Name)
        FileSize2 = objFSO.BuildPath(ResFolderPath,File.Size)
If objFSO.FileExists(FilePath) And (FileSize2 &gt; File.Size) Then &#039; если в папке output есть этот файл и он больше копируемого
            &#039;Если он существует, то производим замену
            objFSO.CopyFile FilePath, objFSO.BuildPath(Folder.Path,&quot;\&quot;)
            AppendToLog &quot;файл &quot;&quot;&quot; &amp; File.Name &amp; &quot;&quot;&quot; скопирован в &quot;&quot;&quot; &amp; Folder.Path &amp; &quot;&quot;&quot;.&quot;
            objFSO.DeleteFile FilePath 
        End if
    Next
 
    &#039;Перебираем все подкаталоги в каталоге
    For Each SubFolder in Folder.SubFolders
        RecursiveFolderScan(SubFolder.Path)
    Next
End Sub
 
Sub AppendToLog(Text)
    TextStream.WriteLine Time &amp; &quot;:&quot; &amp; Text
End Sub
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2013-01-21T17:18:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68760#p68760</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68726#p68726" />
			<content type="html"><![CDATA[<p><strong>griha09</strong>, покажите весь значимый код.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2013-01-20T20:15:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68726#p68726</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68725#p68725" />
			<content type="html"><![CDATA[<p>Если не работает, значит, ошибка в предшествующей части кода (File1/File2 и т.д.).</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2013-01-20T19:34:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68725#p68725</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: не получается логическое И]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=68723#p68723" />
			<content type="html"><![CDATA[<p>Вроде простой вопрос, но что-то не получается. Хочу написать условие &quot;если файл существует и файл1 больше файл2&quot; то....... вот написал<br /> </p><div class="codebox"><pre><code>     If objFSO.FileExists(FilePath) And (File1.Size &gt; File2.Size) Then
</code></pre></div><p>почему-то работает только условие &quot;если файл существует&quot;. Подскажите где ошибка.</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2013-01-20T19:04:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=68723#p68723</id>
		</entry>
</feed>
