mirror of
https://github.com/jarun/nnn.git
synced 2025-01-23 09:16:46 +00:00
Merge pull request #321 from KlzXS/batch-rename
Fix 'batch_rename' moving symlinks
This commit is contained in:
commit
edfcfdfdf4
|
@ -1213,13 +1213,7 @@ static bool batch_rename(const char *path)
|
||||||
int fd1, fd2, i;
|
int fd1, fd2, i;
|
||||||
uint count = 0, lines = 0;
|
uint count = 0, lines = 0;
|
||||||
bool dir = FALSE, ret = FALSE;
|
bool dir = FALSE, ret = FALSE;
|
||||||
const char renamecmd[] =
|
const char renamecmd[] = "awk 'FNR==NR{a[NR]=$0} a[FNR]!=$0{printf \"%%s\\0%%s\\0\",a[FNR],$0}' %s %s | xargs -0 -n2 mv 2>/dev/null";
|
||||||
#ifdef __OpenBSD__
|
|
||||||
/* OpenBSD does not have the -n option for mv */
|
|
||||||
"paste -d'\n' %s %s | tr '\n' '\\0' | xargs -0 -n2 mv 2>/dev/null";
|
|
||||||
#else
|
|
||||||
"paste -d'\n' %s %s | tr '\n' '\\0' | xargs -0 -n2 mv -n 2>/dev/null";
|
|
||||||
#endif
|
|
||||||
char foriginal[TMP_LEN_MAX] = {0};
|
char foriginal[TMP_LEN_MAX] = {0};
|
||||||
char buf[sizeof(renamecmd) + (PATH_MAX << 1)];
|
char buf[sizeof(renamecmd) + (PATH_MAX << 1)];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue