by setting absolutepath = to something you are erasing the previous values
try
absolutepath += absolutepath == null ? ("/" + folders[i] + "/") : absolutepath + folders[i] + "/";
or
absolutepath = absolutepath + absolutepath == null ? ("/" + folders[i] + "/") : absolutepath + folders[i] + "/";
or
if(absolutepath == null)
absolutepath = ("/" + folders[i] + "/");
else
absolutepath += folders[i] + "/";