shell 脚本移动和复制 [英] shell script Move and Copy
问题描述
我有一个名为 rules 的文件夹
I have a folder named rules in
/srv/www/htdocs/downloads
而且我在这里还有另一个具有相同名称规则的文件夹:
and I have another folder with the same name rules in here:
/srv/www/htdocs/didebansnort/core/snort/
我想把上面的文件夹规则复制到第二个路径
I want to copy the folder rules in upper one to the second path
我也想知道移动的语法是什么?
Also I want to know what is the syntax for moving?
推荐答案
与在 shell 中复制/移动内容时使用的相同.这就是为什么他们称其为 shell 脚本:)
the same that you use when you copy/move things in shell. That's why they called shell scripts:)
复制(从 -> 到)
cp -r /srv/www/htdocs/downloads/rules /srv/www/htdocs/didebansnort/core/snort/rules
我们使用cp -r来复制目录(r代表递归)和简单的 cp 用于复制单个文件.
we use cp -r to copy directory (r stands for recursive) and simple cp for copying of a single file.
移动(从 -> 到)
mv /srv/www/htdocs/downloads/rules /srv/www/htdocs/didebansnort/core/snort/rules
这适用于 nix/mac/cygwin
This is for nix/mac/cygwin
附言在 shell 中,您只需输入以下内容即可获得完整的手册:
P.S. While in the shell you can simply type in this to get a complete manual:
man command_name
这篇关于shell 脚本移动和复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!