find . -type d -exec sh -c 'set -- "$0"/*.flac; ! [ -e "$1" ]' {} \; -print
我如何扩展该行以现在递归遍历生成的文件夹列表,列出文件并将文件移动/复制到其他地方。
答案1
找不到有关 Linux 的帮助,或者太笨了,所以我使用了 powershell
# list directories and number of files within each directory
# and copy them away dependent on number of files
$dirs = gci -directory
foreach ($dir in $dirs) {
$nof = (gci -file $dir | measure-object).count
write-host $dir has $nof files
if ($nof -le 4){
copy-item .\$dir\*.* -destination h:\testdir
write-host files will be copied
}
else {
write-host files will not be copied
}
}