Edit: I fixed the duplicate problem.
Thanks a lot for the hints guys. I kinda got what I wanned:
ls $FILEPATH | while read FILE;
if [ -d $FILE ]; then
#notice Im not typing $FILEPATH but FILEPATH
this works perfectly, or at least how I wanned it to work for a min level.
but now if instead of doing:
I want to get info out of this file(ionode, size in bytes, file type and name) using the command stat
echo " `stat --format='%n,%f,%i,%s' $FILE` "
then it works only for the files where Im running the script from but not for subsequent directories. It says it cant find the file. So I did a:
after my if statement right after I echo the directory so I change my current working directory to this new one but it doesnt seem to work.
I also tried concatenating the FILEPATH
echo " `stat --format='%n,%f,%i,%s' $FILEPATH/$FILE` "
Any advise about better practices when it comes to bash programming Ill really appreciate it.
thanks in advance