[英]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.