<?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>文件类型 &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Wed, 16 Oct 2013 02:45:42 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创]rsync同步时，只同步指定的文件类型</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9brsync%e5%90%8c%e6%ad%a5%e6%97%b6%ef%bc%8c%e5%8f%aa%e5%90%8c%e6%ad%a5%e6%8c%87%e5%ae%9a%e7%9a%84%e6%96%87%e4%bb%b6%e7%b1%bb%e5%9e%8b/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9brsync%e5%90%8c%e6%ad%a5%e6%97%b6%ef%bc%8c%e5%8f%aa%e5%90%8c%e6%ad%a5%e6%8c%87%e5%ae%9a%e7%9a%84%e6%96%87%e4%bb%b6%e7%b1%bb%e5%9e%8b/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Thu, 14 Oct 2010 09:14:46 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[exclude]]></category>
		<category><![CDATA[exclude-from]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[指定]]></category>
		<category><![CDATA[指定文件类型]]></category>
		<category><![CDATA[排除]]></category>
		<category><![CDATA[文件类型]]></category>
		<category><![CDATA[用法]]></category>
		<guid isPermaLink="false">http://www.codelast.com/?p=764</guid>

					<description><![CDATA[<p>
	<span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:14px;">使用rsync来同步文件时，如果想要只同步指定的文件类型，怎么做？</span></span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:14px;">我的环境：rsync客户端将文件推送到rsync服务器端。搜了一下网络，看了一下rsync help，似乎是要用exclude参数和include参数配合来实现规则，从而达到只同步指定类型文件的效果，但是我试了一下没成功，于是最终采用了一种可以实现的方法：排除其他所有文件类型。虽然比较麻烦，但是能做到就行</span></span></p>
<p>
<span id="more-764"></span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">使用<strong><span style="color:#00f;">--exclude-from</span></strong>参数，指定一个&#8220;规则文件&#8221;，例如：</span></p>
<p>
	<span style="color:#00f;"><span style="font-size:14px;"><span style="font-family:arial,helvetica,sans-serif;">--exclude-from=&#8220;/root/rules.txt&#8221;</span></span></span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;"><font class="Apple-style-span" size="4">然后在rules.txt中填入过滤规则，例如，我想把要同步的目录下，文件名中含有abc的所有文件都排除在外（即：不同步这些文件），那么rules.txt文件的内容为</font></span></p>
<p>
	<span style="color:#f00;"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:14px;">- *abc*</span></span></span></p>
<p>
	&#160;</p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">注意：&#8220;-&#8221;<span style="color:#f00;">和后面的名字之间有一个空格</span>。&#8220;-&#8221;表示排除。</span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">如果你还想排除其他的文件，那么可以继续添加一行，按照类似的规则填写。</span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">最后一行最好留一个空行。</span></p>
<p>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">这样，我们的准备工作就完成了，然后就可以利用rsync来传输了，带上--exclude-from参数，例如：</span></p>
<p>
	<span style="font-size:14px;"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#00f;">rsync -ravz --exclude-from=&#34;/root/rules.txt&#34;</span> &#8230;&#8230;（后面的省略）</span></span></p>
<p>
	&#160;</p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;"><span style="color:#fff;">NULL</span></span>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9brsync%e5%90%8c%e6%ad%a5%e6%97%b6%ef%bc%8c%e5%8f%aa%e5%90%8c%e6%ad%a5%e6%8c%87%e5%ae%9a%e7%9a%84%e6%96%87%e4%bb%b6%e7%b1%bb%e5%9e%8b/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>
	<span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:14px;">使用rsync来同步文件时，如果想要只同步指定的文件类型，怎么做？</span></span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:14px;">我的环境：rsync客户端将文件推送到rsync服务器端。搜了一下网络，看了一下rsync help，似乎是要用exclude参数和include参数配合来实现规则，从而达到只同步指定类型文件的效果，但是我试了一下没成功，于是最终采用了一种可以实现的方法：排除其他所有文件类型。虽然比较麻烦，但是能做到就行</span></span></p>
<p>
<span id="more-764"></span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">使用<strong><span style="color:#00f;">--exclude-from</span></strong>参数，指定一个&ldquo;规则文件&rdquo;，例如：</span></p>
<p>
	<span style="color:#00f;"><span style="font-size:14px;"><span style="font-family:arial,helvetica,sans-serif;">--exclude-from=&ldquo;/root/rules.txt&rdquo;</span></span></span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;"><font class="Apple-style-span" size="4">然后在rules.txt中填入过滤规则，例如，我想把要同步的目录下，文件名中含有abc的所有文件都排除在外（即：不同步这些文件），那么rules.txt文件的内容为</font></span></p>
<p>
	<span style="color:#f00;"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:14px;">- *abc*</span></span></span></p>
<p>
	&nbsp;</p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">注意：&ldquo;-&rdquo;<span style="color:#f00;">和后面的名字之间有一个空格</span>。&ldquo;-&rdquo;表示排除。</span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">如果你还想排除其他的文件，那么可以继续添加一行，按照类似的规则填写。</span></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">最后一行最好留一个空行。</span></p>
<p>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a></p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;">这样，我们的准备工作就完成了，然后就可以利用rsync来传输了，带上--exclude-from参数，例如：</span></p>
<p>
	<span style="font-size:14px;"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#00f;">rsync -ravz --exclude-from=&quot;/root/rules.txt&quot;</span> &hellip;&hellip;（后面的省略）</span></span></p>
<p>
	&nbsp;</p>
<p>
	<span style="font-family:arial,helvetica,sans-serif;"><span style="color:#fff;">NULL</span></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9brsync%e5%90%8c%e6%ad%a5%e6%97%b6%ef%bc%8c%e5%8f%aa%e5%90%8c%e6%ad%a5%e6%8c%87%e5%ae%9a%e7%9a%84%e6%96%87%e4%bb%b6%e7%b1%bb%e5%9e%8b/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
