3 ms·
A) You're cheating by using the tmpfs filesystem! B) Your directory names are numeric, not alphanumeric and not randomly long C) Your computer specs are missing
by X4 13y ago
A) You're cheating by using the tmpfs filesystem!
B) Your directory names are numeric, not alphanumeric and not randomly long
C) Your computer specs are missing
Now can you please explain why you think that this is faster?
mkdir ../.tmp${RANDOM} &&
mv ./* ../.tmp[0-9]* &&
rm -rf ../.tmp[0-9]* &
I believe that if I write a minimal tool in C it would be much faster than rsync.
I would have to read the fs index if existing, otherwise create a list of directories/files then unlink it in parallel in the inode order. Later optimize ops based on the fs.
- mook 13y agoI don't think tmpfs is involved at all; it's just moving things out of the way instead of deleting, first. The actual delete runs in the background, so you can get an interactive shell back and keep working while the delete happens without blocking you. I usually do an approximate equivalent of just renaming the directory itself and making a new one in its place (and removing the renamed one in the background).