Improving safety of replace command (never modify hidden or tmp folders)