This script only print files from main directory but doesn't print files of an sub directory that is present in main directory.
If not clear what I mean is if I have a main directory and that main directory has 5 sub directories and all of them contains file. I just want to print all of those files.
read filename
for entry in "$filename"/*
do
echo "$entry"
done
I just want to print all of those files.
Then use find
.
find "$filename" -type f
will print all filenames.
I have to ask: which shell? a Linux shell? Powershell?
If Powershell:
$files = Get-Childitem -Recurse
Just don't use this starting at just the C:\
.
But with your read
and echo
, it looks like Linux. have you tried the tree
command?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.