package main func correctPath(path string) string { if path[len(path)-1:] == `/` || path[len(path)-1:] == `\` { // Case: E.g. remote dir = /myfiles/ return path[:len(path)-1] } else { // Case: E.g. remote dir = /myfiles return path } }