Handle previous dirs in download and upload