BAEL-3132 - Linux Commands - Loop Through Directories/Folders (#7682)
* BAEL-3132 - Linux Commands - Loop Through Directories/Folders * BAEL-3132 - Linux Commands - Loop Through Directories/Folders - update pom description. * BAEL-3132 - Linux Commands - Loop Through Directories/Folders - Add another example using find exec. * BAEL-3132 - Linux Commands - Loop Through Directories/Folders
This commit is contained in:
parent
ec23ab367e
commit
8673e3a460
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
find . -maxdepth 1 -mindepth 1 -type d -printf '%f\n'
|
||||
|
||||
find . -maxdepth 1 -mindepth 1 -type d | while read dir; do
|
||||
echo "$dir"
|
||||
done
|
||||
|
||||
find . -maxdepth 1 -type d -exec echo {} \;
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
for dir in */; do
|
||||
echo "$dir"
|
||||
done
|
||||
|
||||
for file in *; do
|
||||
if [ -d "$file" ]; then
|
||||
echo "$file"
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue