I have code that traverses a directory, and finds all the files with a .xz
extension
The problem is I cannot seem to figure out how to access each iterated file with .xz
instead i get the value of ROOTPATH
. what am i doing wrong?
ROOTPATH='/home/user/path'
for file in "$ROOTPATH"; do
find $PWD -name '*.xz'
echo "file is $file"
done
This outputs the files like:
/home/user/path/file1.tar.xz
/home/user/path/file2.tar.xz
then the echo
portion prints:
file is /home/user/path
how can i access each of the iterated items, e.g.
/home/user/path/file1.tar.xz
/home/user/path/file2.tar.xz
thank you
shopt
– Inian Oct 12 '17 at 18:31