<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>阅微堂 &#187; 备份</title>
	<atom:link href="http://zhiqiang.org/blog/tag/%e5%a4%87%e4%bb%bd/feed" rel="self" type="application/rss+xml" />
	<link>http://zhiqiang.org/blog</link>
	<description>理工科背景的证券从业人员</description>
	<lastBuildDate>Sun, 05 Feb 2012 03:59:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>用Matlab脚本同步和备份资料</title>
		<link>http://zhiqiang.org/blog/it/sync-and-backup-using-matlab.html</link>
		<comments>http://zhiqiang.org/blog/it/sync-and-backup-using-matlab.html#comments</comments>
		<pubDate>Sat, 16 Oct 2010 03:49:14 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[同步]]></category>
		<category><![CDATA[备份]]></category>
		<category><![CDATA[生活中的Matlab]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/?p=1281</guid>
		<description><![CDATA[博客 » IT技术 » 生活中的Matlab » 系列：生活中的Matlab 查看该系列所有文章 基于将工作文件在家里电脑和公司电脑上的转移、Kindle上电子书的管理的需求，我用Matlab写了几个函数，用来实现这些需求。 主要有两个函数： 1、syncfolder用来同步文件夹。syncfolder(p1, p2, direction)可将文件夹p1和p2进行同步，direction控制同步的方向。比如direction为0时为双向同步，direction为1时将p1中的新...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/it">IT技术</a> » <a href='http://zhiqiang.org/blog/tag/%e7%94%9f%e6%b4%bb%e4%b8%ad%e7%9a%84matlab'>生活中的Matlab</a>  » </p><div class="series"><span>系列：<b>生活中的Matlab</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e7%94%9f%e6%b4%bb%e4%b8%ad%e7%9a%84matlab">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>基于将工作文件在家里电脑和公司电脑上的转移、Kindle上电子书的管理的需求，我用Matlab写了几个函数，用来实现这些需求。</p>
Note: There is a file embedded within this post, please visit this post to download the file.
<h4>主要有两个函数：</h4>
<p>1、<strong>syncfolder用来同步文件夹</strong>。syncfolder(p1, p2, direction)可将文件夹p1和p2进行同步，direction控制同步的方向。比如direction为0时为双向同步，direction为1时将p1中的新文件同步到p2，direction为2时将p1中的新文件同步到p2，并且将p2中多余的文件删除；direction为-1或-2时含义类似，不过方向相反而已。</p>
<p>2、<strong>backupfolder用来备份文件夹</strong>。backupfolder(p1, p2)将文件夹p1备份到p2目录。每次备份时，将在p2下建立一个以当天日期命名的文件夹，并且将p1目录下在上次备份后更新或新增文件都备份到该新建的文件夹中。</p>
<p>为配合backupfolder的使用，另外还有两个功能函数，其一为getbackups。<strong>getbackups(fileName, backupPath)可以返回备份目录backupPath下所有fileName的历史版本</strong>，其中fileName为相对于备份根目录的相对路劲，也可以文件夹名字。</p>
<p>另一个功能函数为<strong>revertbackup，用来恢复历史文件</strong>。使用方法为revertbackup(revertPath, backupPath, savePath, begDate)，其中revertPath为所需要恢复的文件或文件夹（用在备份目录backupPath下的相对路径表示）。revertPath上所有文件的在begDate之后的最新版本都被保存到savePath目录下。</p>
<h4>同步Matlab工作文件</h4>
<p>每天下班后都需要将文件copy到U盘带回家去做，我的工作文件位于'D:\My Documents\MATLAB\'，需要将这些文件复制到U盘更目录下的matlab目录下。这时候只需要运行</p>
<pre>for i = 1:10
    matlabpath= [char(i+'D'), ':\matlab\'];
    if isdir(matlabpath), break; end
end
syncfolder('D:\My Documents\MATLAB\', matlabpath);</pre>
<h4>同步Kindle的电子书</h4>
<p>我已经收集了上百本几百M的电子书，这些电子书被归类整理到电脑分类文件夹中。在之前，我只能选择将所有电子书复制粘贴到Kindle中，尽管可能只新增几本书，也需要将所有书都传输一遍。而用上面的函数，只需要运行下面代码，每次自动只传输新增加的书</p>
<pre>for i = 1:10
    kindlepath = [char(i+'D'), ':\DK_Documents\'];
    if isdir(kindlepath), break; end
end

syncfolder('D:\My Documents\ebooks\', kindlepath, 1);</pre>
<h4>备份工作文档</h4>
<p>比如我将所有Matlab代码都保存在D:\My Documents\MATLAB\。但我担心不小心误删自己的代码，所以我将下面这行代码放在startup.m里面，Matlab每次打开时会自动帮我备份</p>
<pre>backupfolder('D:\My Documents\MATLAB\', 'D:\backup\Matlab');</pre>
<p>如果我误删了文件夹'D:\My Documents\MATLAB\tools\'，这时候我只需要运行</p>
<pre>revertbackup('tools', 'D:\backup\Matlab', 'D:\My Documents\MATLAB\tools\')</pre>
<p>便会恢复tools目录下的所有备份过的文件。也可以通过getbackups查看某文件比如startup.m在历史上所有版本（相当于wikipedia的历史版本的概念）</p>
<pre>a = getbackups('startup.m', 'D:\backup\Matlab')</pre>
<p>然后通过visdiff(a{1}, a{2})可以查看历史版本的差异。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/it/all-articles-into-msn-spaces.html">导入MSN Spaces所有文章</a></li><li><a href="http://zhiqiang.org/blog/it/integer-programming-solving-sudoku.html">整数规划思想求解数独游戏</a></li><li><a href="http://zhiqiang.org/blog/it/batch-resize-images-using-matlab.html">批量修改图片大小的Matlab脚本</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2010. | <a href="http://zhiqiang.org/blog/it/sync-and-backup-using-matlab.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/sync-and-backup-using-matlab.html#comments">17 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/sync-and-backup-using-matlab.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>导入MSN Spaces所有文章</title>
		<link>http://zhiqiang.org/blog/it/all-articles-into-msn-spaces.html</link>
		<comments>http://zhiqiang.org/blog/it/all-articles-into-msn-spaces.html#comments</comments>
		<pubDate>Sun, 02 Apr 2006 02:47:46 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[MSN Spaces]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[备份]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/?p=261</guid>
		<description><![CDATA[博客 » IT技术 » WordPress » 此方法也适用于单纯给MSN Spaces备份. MSN Spaces自己不提供备份功能，虽然说Spaces服务器比我自己的机器更有保障，可是身在中国，很难说不会步Andy的后尘: 他的Blog就在未通知的情况下完全被删除，而且Spaces的服务条框里面也申明了保持这种权力。另外有些时候需要转换阵地也用得着。 直接保存RSS是不行的，因为这只能保存最近的20来篇文章。不过你够...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/it">IT技术</a> » <a href='http://zhiqiang.org/blog/tag/wordpress'>WordPress</a>  » </p><p>此方法也适用于单纯给MSN Spaces备份.</p>
<p>MSN Spaces自己不提供备份功能，虽然说Spaces服务器比我自己的机器更有保障，可是身在中国，很难说不会步Andy的后尘: 他的Blog就在未通知的情况下完全被删除，而且Spaces的服务条框里面也申明了保持这种权力。另外有些时候需要转换阵地也用得着。</p>
<p>直接保存RSS是不行的，因为这只能保存最近的20来篇文章。不过你够变态的话，可以保存之后，把前20篇文章都删了，继续保存RSS，经过若干次后，就把所有文章保存下来了 <img src='http://zhiqiang.org/blog/wp-includes/images/smilies/smile.gif' alt=':)' class='wp-smiley' /> 。此方法让Spaces完全废弃，慎用。</p>
<p>这里讲的方法基于<a href="http://www.blogbus.com">Blogbus</a>新提供的一个给blog"搬家"服务：<a href="http://banjia.blogbus.com/">http://banjia.blogbus.com/</a>，它不光适用于MSN Spaces，还提供了国内几家最有名的BSP，比如新浪，blogcn等。</p>
<p>具体操作：填入你的spaces地址 http://spaces.msn.com/yourblog/，值得注意的是yourblog后面的斜杠一定要写，切记切记。然后就等着吧，注意正常情况下页面会不断刷新，否则后退重来吧。运行时间跟文章数有关，一般情况四五个小时是少不了的，切记此间不能关机关浏览器，另外让主保佑你的网络不会有丝毫中断。建议睡前开始备份，睡一觉之后再检查结果，以免神经焦虑过度。</p>
<p>到这里还不够，Blogbus没那么好心，帮我们弄出的数据不是标准的RSS文件，只能用在它自己的Blog上。不过群众的力量是无穷的，我们伟大的<a href="http://bingu.net/228/blog%e4%b8%8a%e5%a4%aa%e7%a9%ba%e5%95%a6%ef%bd%9e%ef%bd%9e/">冰古</a>同学早就有了<a href="http://bingu.net/290/%e4%bb%8eblogbus%e8%b7%b3%e8%bd%ac%e5%88%b0wordpress/">解决方案</a>(<a href="http://sites.google.com/site/zhongygah/">下载</a>)，他自己写了一个小工具，用来将Blogbus的备份格式转换成标准的RSS2.0格式，以便让其它Blog系统或者RSS阅读器，比如WordPress，进行导入。</p>
<p>这种备份方式会把所有评论也备份下来，可是目前除了blogbus自己的blog没有平台可以导入评论。可是重要的文章分类倒是没有备份，很奇怪的问题。</p>
<p>用上面方法，我已经我的spaces的所有文章都导入了<a href="http://zhiqiang.org/blog/">自搭的blog平台</a>。因为这些文章大部分都是我做转载王的时候转载的一些好文章，数量也很多，1年的时间里有将近250篇，具体统计数量见<a href="http://zhiqiang.org/blog/">这里</a>。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/it/windows-live-spaces-die.html">MSN Spaces终于要死掉了</a></li><li><a href="http://zhiqiang.org/blog/it/sync-and-backup-using-matlab.html">用Matlab脚本同步和备份资料</a></li><li><a href="http://zhiqiang.org/blog/it/my-experiences-and-views-blog.html">我的Blog经历和一些看法</a></li><li><a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">搞定乱码，WordPress搬家到dreamhost</a></li><li><a href="http://zhiqiang.org/blog/it/wordpress-accelerate-the-pace-of-pages-printed-in-the-generation-and.html">加快WordPress的页面生成和载入速度</a></li><li><a href="http://zhiqiang.org/blog/it/blog-fast-download-speeds-to-be-faster-and-the-speed-of-blog.html">blog下载速度多快才算快和blog速度优化</a></li><li><a href="http://zhiqiang.org/blog/it/wordpress-21-solution-can-not-remove-the-article-upgrade-to-213.html">WordPress 2.1无法删除文章解决方法 &amp; 升级到2.1.3</a></li><li><a href="http://zhiqiang.org/blog/it/bbpress-installation-problems-and-several-plug-ins.html">bbPress的安装问题和几个插件</a></li><li><a href="http://zhiqiang.org/blog/it/wordpress-blog-has-different-domains.html">同一WordPress的blog可拥有多个域名</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/move-blogbus-data-to-wordpress.html">BlogBus搬家文件转WordPress导入文件</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/it/all-articles-into-msn-spaces.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/all-articles-into-msn-spaces.html#comments">6 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/all-articles-into-msn-spaces.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

