SFTP: don't do $dir[-1] check if $dir === ''