Copy files from input file with dir structure

Hi,
with that if condiition i can check the presence of folder .Is there any way to reduce the dir depth one by one level and create dir for those if it is not present till
/home/guest/source/Dest

For example:

/home/guest/source/Dest/prj/main_src/lib/a.c
/home/guest/source/Dest/prj/test-scripts/z.py

Above mentioned example has dir depths 3,2 after Dest.
dir depth can go till 7 .

Thanks in advance.

You can do something like:

dir=$(find -type d -name "Dest")

if [ -z "$dir" ]; then
  mkdir /home/guest/source/Dest
  Dest=/home/guest/source/Dest
else
  Dest="$dir"
fi

cp ${Source}${file} ${Dest}${file}

hi,

thanks franklin for all your inputs. mkdir -p didnt work as expected on friday :frowning: ( may be incorrect path).