[问题]求助关于cp命令
发表于 : 2008-06-17 13:33
我在a文件夹下有26个字文件夹,每个文件夹有很多小文件,总数大概2万多,怎么用命令把这所有的2万个文件复制到一个文件夹b下
是要打散文件夹吗ffsxsy 写了:我在a文件夹下有26个字文件夹,每个文件夹有很多小文件,总数大概2万多,怎么用命令把这所有的2万个文件复制到一个文件夹b下
打散结构,要考虑同名文件的问题。BigSnake.NET 写了:是要打散文件夹吗ffsxsy 写了:我在a文件夹下有26个字文件夹,每个文件夹有很多小文件,总数大概2万多,怎么用命令把这所有的2万个文件复制到一个文件夹b下
就是说 b 下没有 a 下的文件夹结构, 只有文件
是这样的BigSnake.NET 写了:是要打散文件夹吗ffsxsy 写了:我在a文件夹下有26个字文件夹,每个文件夹有很多小文件,总数大概2万多,怎么用命令把这所有的2万个文件复制到一个文件夹b下
就是说 b 下没有 a 下的文件夹结构, 只有文件
ffsxsy 写了:是这样的BigSnake.NET 写了:是要打散文件夹吗ffsxsy 写了:我在a文件夹下有26个字文件夹,每个文件夹有很多小文件,总数大概2万多,怎么用命令把这所有的2万个文件复制到一个文件夹b下
就是说 b 下没有 a 下的文件夹结构, 只有文件
代码: 全选
cd a && find -type f -exec cp -iv {} ../b/ \;
能不能解释一下BigSnake.NET 写了:ffsxsy 写了:是这样的BigSnake.NET 写了:是要打散文件夹吗ffsxsy 写了:我在a文件夹下有26个字文件夹,每个文件夹有很多小文件,总数大概2万多,怎么用命令把这所有的2万个文件复制到一个文件夹b下
就是说 b 下没有 a 下的文件夹结构, 只有文件代码: 全选
cd a && find -type f -exec cp -iv {} ../b/ \;
,看起来好复杂find -type f -exec cp -iv {} ../b/ \
ffsxsy 写了:能不能解释一下BigSnake.NET 写了:ffsxsy 写了:是这样的BigSnake.NET 写了:是要打散文件夹吗ffsxsy 写了:我在a文件夹下有26个字文件夹,每个文件夹有很多小文件,总数大概2万多,怎么用命令把这所有的2万个文件复制到一个文件夹b下
就是说 b 下没有 a 下的文件夹结构, 只有文件代码: 全选
cd a && find -type f -exec cp -iv {} ../b/ \;
,看起来好复杂find -type f -exec cp -iv {} ../b/ \
最后边分号前的“\”是什么意思?cd a && find -type f -exec cp -iv {} ../b/ \;
man findffsxsy 写了:都是牛人!最后一个问题
最后边分号前的“\”是什么意思?cd a && find -type f -exec cp -iv {} ../b/ \;
代码: 全选
-exec command ;
Execute command; true if 0 status is returned. All following
arguments to find are taken to be arguments to the command until
an argument consisting of `;' is encountered. The string `{}'
is replaced by the current file name being processed everywhere
it occurs in the arguments to the command, not just in arguments
where it is alone, as in some versions of find. Both of these
constructions might need to be escaped (with a `\') or quoted to
protect them from expansion by the shell. See the EXAMPLES sec-
tion for examples of the use of the `-exec' option. The speci-
fied command is run once for each matched file. The command is
executed in the starting directory. There are unavoidable
security problems surrounding use of the -exec option; you
should use the -execdir option instead.