handle broken links with 'select' command

Related #201
This commit is contained in:
Gokcehan committed 2020-07-20 02:15:30 +03:00
1 parent 6d1a840587
commit 7174b7e307
4 files changed
+8 -8

No files matched your search

+2 -2
View File
@@ -86,12 +86,12 @@ func copyAll(srcs []string, dstDir string) (nums chan int64, errs chan error) {
for _, src := range srcs {
dst := filepath.Join(dstDir, filepath.Base(src))
_, err := os.Stat(dst)
_, err := os.Lstat(dst)
if !os.IsNotExist(err) {
var newPath string
for i := 1; !os.IsNotExist(err); i++ {
newPath = fmt.Sprintf("%s.~%d~", dst, i)
_, err = os.Stat(newPath)
_, err = os.Lstat(newPath)
}
dst = newPath
}