News for hackers. Stuff that matters.
Re:Byenow – A command-line Windows utility for faster folder... by alkonaut on Thursday February 20, 2020 @06:25AM (#22374289)
It always amazed me that deleting a remote directory with thousands of files can be so much slower than remoting into the server, and deleting the directory. I don't want to recursively list the remote files and then delete them one by one. I just want to remove the directory from the remote filesystem!

Can a tool solve that problem? (I guess powershell remote scripts could?)

Re:Byenow – A command-line Windows utility for faster folder... by apankrat on Thursday February 20, 2020 @06:47AM (#22374372)
There's no way to delete multiple files with a single syscall. There's also no way to purge the folder of all its contents. At least not on Windows, using an API.
Re:Byenow – A command-line Windows utility for faster folder... by alkonaut on Thursday February 20, 2020 @07:09AM (#22374464)
The syscalls are quick enough when done locally. What I think is going on is that for a directory with N files on a share, I get N (or likely multiples of N) network roundtrips.

If the network round trip time is 1second and the time to delete the directory with 1000 files is 1 second when done on the local drive, then I want the delete on the network share to be 2 seconds not 2000 or 4000 seconds.

Re:Byenow – A command-line Windows utility for faster folder... by apankrat on Thursday February 20, 2020 @07:41AM (#22374646)
For deleting - yes, you will get a round-trip per delete request. So if they are serialized (which is the case with standard tools), it will be excruciatingly slow indeed.

For scanning - you'll get the list of content in chunks. The size of a chunk depends on the size of the buffer you provide. For smaller folders it'll normally fit in a single request.

Re:Byenow – A command-line Windows utility for faster folder... by pbhjpbhj on Thursday February 20, 2020 @10:06AM (#22375531)
(I'm just a hobbyist)

Is that how .+n[i|u]x's unlink command works? IIRC you can unlink a directory.

If that's true, how does MS's WSL handle unlink?

Why doesn't Windows del work like that, surely at the physical layer the drive is only removing allocation entries?

Re:Byenow – A command-line Windows utility for faster folder... by jjnoakes on Thursday February 20, 2020 @10:52AM (#22375894)
unlink(2) returns EISDIR (on Linux at least) if you try to unlink a directory. I'm not sure if you can still do it, but long ago you could unlink(2) a directory as root, but it was not a good idea since it did not recursively free up the contents back to the file system's raw storage.

To remove a directory on Linux you have to empty it out (recursively, using unlink(2) on files and rmdir(2) on empty directories) and then rmdir(2) the top level directory.

So not a single system call.

Re:Byenow – A command-line Windows utility for faster folder... by pbhjpbhj on Saturday February 22, 2020 @10:08AM (#22391358)
Thanks for humouring me, everyday a learning day - especially when there are kind people happy to share their knowledge ;o)