我正在使用参数–exclude .htaccess来阻止所有文件被复制.我包括的其他参数是-a –recursive –times –perms.是否可以配置rsync来执行此 *** 作?
编辑:
这是我的完整命令:
rsync -a --recursive --times --perms \ --exclude prop_images --exclude tracking --exclude vtours \ --exclude .htaccess --exclude .htaccess_backup --exclude "*~" \ /home/user/dev_HTML/* /home/user/public_HTML/解决方法 指定–exclude .htaccess时,将排除以.htaccess结尾的任何路径.
要仅排除传输源根目录下的.htaccess,您需要–exclude /.htaccess
从rsync手册页,一些更详细的信息和对其他阅读的参考:
if the pattern starts with a / then it is anchored to a particular spot in the hIErarchy of files,otherwise it is matched against the end of the pathname. This is similar to a leading ^ in regular Expressions. Thus “/foo” would match a file named “foo” at either the “root of the transfer” (for a global rule) or in the merge-file’s directory (for a per-directory rule). An unqualifIEd “foo” would match any file or directory named “foo” anywhere in the tree because the algorithm is applIEd recursively from the top down; it behaves as if each path component gets a turn at being the end of the file name. Even the unanchored “sub/foo” would match at any point in the hIErarchy where a “foo” was found within a directory named “sub”. See the section on ANCHORING INCLUDE/EXCLUDE PATTERNS for a full discussion of how to specify a pattern that matches at the root of the transfer.总结
以上是内存溢出为你收集整理的rsync – 如何排除一个.htaccess但不是全部.htaccess全部内容,希望文章能够帮你解决rsync – 如何排除一个.htaccess但不是全部.htaccess所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)