it is feature complete and I don't plan on updating it further
a tiny wrapper around renameat2(...)
and RENAME_EXCHANGE
to do
atomic (directory) replacement
see the releases tab for precompiled binaries.
smaller, static
musl-gcc -O3 -s -static main.c -o rename-exchange
larger, dynamically linked
gcc -O3 -s main.c -o rename-exchange
as this uses renameat2(...)
it can only be used on linux>3.15
$ ls -l foo bar
bar:
total 0
-rw-r--r-- 1 asottile asottile 0 May 16 13:35 wat
foo:
total 0
-rw-r--r-- 1 asottile asottile 0 May 16 13:35 wat2
$ rename-exchange foo bar
$ ls -l foo bar
bar:
total 0
-rw-r--r-- 1 asottile asottile 0 May 16 13:35 wat2
foo:
total 0
-rw-r--r-- 1 asottile asottile 0 May 16 13:35 wat