<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; WSH: резервная копия почты Mozilla Thunderbird]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6343&amp;type=atom" />
	<updated>2011-10-25T12:15:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6343</id>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52903#p52903" />
			<content type="html"><![CDATA[<p>OFF:<br /></p><div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>Доработка потребуется: если последний item — папка с большим количеством папок и файлов — скрипт опять не успеет.</p></blockquote></div><p>Спасибо, я что-то подобное подозревал.<br />Если дело именно в последнем item, доработка упрощается — если это папка, можно приложить условие к ней и так при необходимости по цепочке.<br />Но если не быть уверенным в &quot;естественном&quot; порядке добавления файлов в zip, то придётся использовать полноценную рекурсию или перебор в глубину.<br />Решение с проверкой .Items.Count я подсмотрел на этом форуме (см. <a href="http://forum.script-coding.com/viewtopic.php?pid=7358#p7358">Коллекцию</a>, автор примера - <strong>Xameleon</strong>: </p><div class="codebox"><pre><code>&#039;...
    Function CopyFolderToArchive(FolderPath)
        If (ArchiveFolder Is Nothing) Then Exit Function
        ArchiveFolder.CopyHere FolderPath
        ItemsCount = ItemsCount + 1
    End Function 

    Function CloseArchive
        If (ArchiveFolder is Nothing) Then Exit Function
        Set WsriptShell = CreateObject(&quot;Wscript.Shell&quot;)
        If IsObject(Wscript) Then
            Do
                Wscript.Sleep 100
            Loop Until ArchiveFolder.Items.Count =&gt; ItemsCount
        Else
            ServerSleep
        End if
        ItemsCount = 0
    End Function
&#039;...</code></pre></div><p>) - сам бы к своему стыду до него, вероятно, не додумался,<br />а через небольшие промежутки времени проверял бы размер создаваемого ZIP до тех пор пока он не перестал бы увеличиваться - не знаю, насколько это надёжно...</p>]]></content>
			<author>
				<name><![CDATA[shiz]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26249</uri>
			</author>
			<updated>2011-10-25T12:15:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52903#p52903</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52868#p52868" />
			<content type="html"><![CDATA[<p>Интересная тема получилась... Можно же было сделать проще (я конечно не ас в этом деле, но на форумах кое чему научился) есть 7zip и бесплатный,&nbsp; если конечно архивировать, но хотелось бы:<br />на диск D: в определенную папку делать синхронизацию почты, в этой же папке сразу после архивации делать архив и все..</p>]]></content>
			<author>
				<name><![CDATA[magistic]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27300</uri>
			</author>
			<updated>2011-10-24T21:50:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52868#p52868</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52863#p52863" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>А должен <img src="//forum.script-coding.com/img/smilies/lol.png" width="15" height="15" />?</p></blockquote></div><p>Ну... <a href="http://forum.script-coding.com/viewtopic.php?pid=52376#p52376">Про ZIP речь вроде не шла</a> <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /><br />Сорри, <a href="http://forum.script-coding.com/viewtopic.php?pid=52687#p52687">становится не видно смысла данной темы</a> <img src="//forum.script-coding.com/img/smilies/yikes.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-10-24T16:08:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52863#p52863</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52862#p52862" />
			<content type="html"><![CDATA[<p>OFF:</p><div class="quotebox"><cite>dab00 пишет:</cite><blockquote><p>Уважаемый <strong>alexii</strong>, как повелось, может возразить…</p></blockquote></div><p>А должен <img src="//forum.script-coding.com/img/smilies/lol.png" width="15" height="15" />?</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2011-10-24T15:50:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52862#p52862</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52861#p52861" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>shiz пишет:</cite><blockquote><p>Это не научный подход - гадать с WScript.Sleep <img src="//forum.script-coding.com/img/smilies/neutral.png" width="15" height="15" />.<br />По-моему, будет правильнее (хотя возможно, и потребуется доработка...</p></blockquote></div><p>По-моему форум для того и создан... <br />Вот Вы уже и сами предложили более рациональное решение.<br />Меня всего лишь заинтересовал вопрос как зазиповать с помощью скрипта - что нагуглил - трансформировал в ответ на Ваш пост <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Наверняка, захотите - решите.<br />Уважаемый <strong>alexii</strong>, как повелось, может возразить - кто упоминал про zip? <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-10-24T15:14:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52861#p52861</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52856#p52856" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>shiz пишет:</cite><blockquote><p>По-моему, будет правильнее (хотя возможно, и потребуется доработка</p></blockquote></div><p>Доработка потребуется: если последний item — папка с большим количеством папок и файлов — скрипт опять не успеет. Но подход, конечно, более разумный, нежели «на авось».</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2011-10-24T10:06:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52856#p52856</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52854#p52854" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>dab00 пишет:</cite><blockquote><div class="codebox"><pre><code>&#039; ...
objShell.NameSpace(strZipPath).CopyHere objFolder.Items
 
Set objFolder = Nothing
Set objShell = Nothing
&#039;если размер каталога большой - добавьте секунд
WScript.Sleep 1000</code></pre></div><p>В коде читаем коммент: &quot;&#039;если размер каталога большой - добавьте секунд&quot;<br />Попробуйте WScript.Sleep 5000, или даже 10000 - наверняка <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />.</p></blockquote></div><p>Это не научный подход - гадать с WScript.Sleep <img src="//forum.script-coding.com/img/smilies/neutral.png" width="15" height="15" />.<br />По-моему, будет правильнее (хотя возможно, и потребуется доработка<br />+ добавте объявление objZipFolder и intCount): </p><div class="codebox"><pre><code>&#039; ...
intCount = objFolder.Items.Count
Set objZipFolder = objShell.NameSpace(strZipPath)
objZipFolder.CopyHere objFolder.Items
While objZipFolder.Items.Count &lt; intCount
  WScript.Sleep 500
Wend

Set objFolder = Nothing
Set objShell = Nothing</code></pre></div>]]></content>
			<author>
				<name><![CDATA[shiz]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26249</uri>
			</author>
			<updated>2011-10-24T09:24:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52854#p52854</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52848#p52848" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>magistic пишет:</cite><blockquote><p>как ни странно но архив получается пустым</p></blockquote></div><p>В коде читаем коммент: &quot;&#039;если размер каталога большой - добавьте секунд&quot;<br />Попробуйте WScript.Sleep 5000, или даже 10000 - наверняка <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-10-24T04:02:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52848#p52848</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52845#p52845" />
			<content type="html"><![CDATA[<p>как ни странно но архив получается пустым</p>]]></content>
			<author>
				<name><![CDATA[magistic]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27300</uri>
			</author>
			<updated>2011-10-23T21:35:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52845#p52845</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52812#p52812" />
			<content type="html"><![CDATA[<p>Можно упаковать в zip-архив следующим образом:<br /></p><div class="codebox"><pre><code>
Option Explicit
Dim fso, objShell, wshShell
Dim strZipPath
Dim objFolder

Set wshShell = CreateObject(&quot;WScript.Shell&quot;)
&#039;путь к zip-файлу
strZipPath = wshShell.CurrentDirectory &amp; &quot;.zip&quot;

Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
&#039;создаем пустой zip-файл
fso.CreateTextFile(strZipPath, True).Write &quot;PK&quot; &amp; Chr(5) &amp; Chr(6) &amp; String(18, vbNullChar)
Set fso = Nothing

Set objShell = CreateObject(&quot;Shell.Application&quot;)
Set objFolder = objShell.NameSpace(wshShell.CurrentDirectory)
Set wshShell = Nothing

objShell.NameSpace(strZipPath).CopyHere objFolder.Items

Set objFolder = Nothing
Set objShell = Nothing
&#039;если размер каталога большой - добавьте секунд
WScript.Sleep 1000</code></pre></div><p>Скрипт пакует содержание текущего каталога.<br />Распаковать можно так:<br /></p><div class="codebox"><pre><code>
Option Explicit
Dim fso, objShell, wshShell
Dim strZipPath

Set wshShell = CreateObject(&quot;WScript.Shell&quot;)
&#039;путь к zip-файлу
strZipPath = wshShell.CurrentDirectory &amp; &quot;.zip&quot;
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
If fso.FileExists(strZipPath) Then	
	Set objShell = CreateObject(&quot;Shell.Application&quot;)
	objShell.NameSpace(wshShell.CurrentDirectory).CopyHere(objShell.NameSpace(strZipPath).Items)
	Set objShell = Nothing	
End If
Set fso = Nothing
Set wshShell = Nothing</code></pre></div><p>Подобным образом можете резервировать/распаковывать каталоги: <br />- objShell.NameSpace(&amp;H1a).Self.Path &amp; &quot;\Thunderbird&quot;<br />- objShell.NameSpace(&amp;H1c).Self.Path &amp; &quot;\Thunderbird&quot;<br />или где там находятся файлы Вашей птицы <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-10-23T05:05:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52812#p52812</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52747#p52747" />
			<content type="html"><![CDATA[<p>В принципе C:\Program Files\Mozilla Thunderbird можно и не резервировать, но просто чтоб каждый раз не устанавливать её и + плагины к ней, а так просто можно скопировать и скриптом поместить просто ярлыки пользователям, она после запускается со всеми настройками. А так приходиться кучу программ ставить под админскими правами.</p>]]></content>
			<author>
				<name><![CDATA[magistic]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27300</uri>
			</author>
			<updated>2011-10-20T21:42:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52747#p52747</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52721#p52721" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>C:\Program Files\Mozilla Thunderbird</p></blockquote></div><p>А это зачем?</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2011-10-20T06:46:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52721#p52721</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[WSH: резервная копия почты Mozilla Thunderbird]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52719#p52719" />
			<content type="html"><![CDATA[<p>Помогите написать скрипт резервной копии почты Mozilla Thunderbird. Дело в том что нужно резервировать три папки:<br />C:\Program Files\Mozilla Thunderbird<br />C:\Documents and Settings\Users\Application Data\Thunderbird<br />C:\Documents and Settings\Users\Local Settings\Application Data\Thunderbird<br />для всех пользователей в сети, список пользователей можно либо в скрипте прописать либо отдельным файлом тхт-например и можно еще и лог файл чтоб создавался.</p>]]></content>
			<author>
				<name><![CDATA[magistic]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27300</uri>
			</author>
			<updated>2011-10-20T06:16:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52719#p52719</id>
		</entry>
</feed>
