Help to understand what the problem is, like the script has to dig deep into the folders, but in the end it looks like it goes so that it flies higher in the hierarchy. In the console complains of too deep recursion
code
#!/bin/ksh fileList= catalogHier() { fileList=( "$1" ) curContent=`ls --format single-column` for str in $curContent do curWay=`pwd` fileList[${#fileList[@]}]="$curWay/$str" if [ -d ${fileList[i]} ] then cd ${fileList[i]} fileList=( `catalogHier $fileList` ) fi done cd ../ echo ${fileList[@]} } finalFileList=( `catalogHier $fileList` ) echo There flistSize=${#finalFileList[@]} # for (( i = 0; i < flistSize; i++ )); do # #statements # echo "Content : ${finalFileList[$i]}" # done
Attempt to solve through find
while `read -rd $'\0' file`; do echo "Content $file" done < `find ./dir0 `
for str in``find ./dir0``; do
for str in``find ./dir0``; do
, but then folders / files with spaces are poorly handled. Or is there also a more simple way? - I. Smirnovfind
: why when running the script whileread -rd $'\0' file
; do echo "$file" done < "
; do echo "$file" done < "
find ./dir0
" the first line displays the path to the script file that is executed, and the last line showscannot open *последний найденный файл*
- I. Smirnov