在 OSX 中展平文件结构时自动覆盖
Auto overwrite when flattening file structure in OSX
我正在尝试平展 OSX 中包含许多重复文件的目录。
到目前为止我有....
find /directory -mindepth 2 -type f -exec mv -i '{}' /directory ';'
但是这个回答问了我很多次:
overwrite /directory/file.xml? (y/n [n])
not overwritten
有人可以帮我设置标志以自动接受 yes/no 吗?
提前致谢
对于 mv
命令
,您应该使用选项 -f
而不是 -i
find /directory -mindepth 2 -type f -exec mv -f '{}' /directory ';'
在mv
的手册中:
-f Do not prompt for confirmation before overwriting the destination path. (The -f option overrides any
previous -i or -n options.)
-i Cause mv to write a prompt to standard error before moving a file that would overwrite an existing file.
If the response from the standard input begins with the character `y' or `Y', the move is attempted.
(The -i option overrides any previous -f or -n options.)
我正在尝试平展 OSX 中包含许多重复文件的目录。
到目前为止我有....
find /directory -mindepth 2 -type f -exec mv -i '{}' /directory ';'
但是这个回答问了我很多次:
overwrite /directory/file.xml? (y/n [n])
not overwritten
有人可以帮我设置标志以自动接受 yes/no 吗?
提前致谢
对于 mv
命令
-f
而不是 -i
find /directory -mindepth 2 -type f -exec mv -f '{}' /directory ';'
在mv
的手册中:
-f Do not prompt for confirmation before overwriting the destination path. (The -f option overrides any
previous -i or -n options.)
-i Cause mv to write a prompt to standard error before moving a file that would overwrite an existing file.
If the response from the standard input begins with the character `y' or `Y', the move is attempted.
(The -i option overrides any previous -f or -n options.)