![](/img/trans.png)
[英]Moving all directories which have a specified number of files, to another directory
[英]shell scripting : I have a main directory which contain few other directories and I want to print all files inside those directories
此脚本仅打印主目录中的文件,但不打印主目录中存在的子目录的文件。
如果不清楚我的意思是如果我有一个主目录并且该主目录有 5 个子目录并且它们都包含文件。 我只想打印所有这些文件。
read filename
for entry in "$filename"/*
do
echo "$entry"
done
我只想打印所有这些文件。
然后使用find
。
find "$filename" -type f
将打印所有文件名。
不得不问:shell是哪个? Linux shell? Powershell?
如果 Powershell:
$files = Get-Childitem -Recurse
只是不要从C:\
开始使用它。
但是通过您的read
和echo
,它看起来像 Linux。 你试过tree
命令吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.