On Sun, Jan 23, 2022 at 6:56 PM Dick Steffens <[email protected]> wrote:

> Sometimes, when I do a screenshot, I get, in addition to the image I
> want, another "file" that ends in .part.


this is a result of a complicated solution created to solve a
seldom-experienced problem. however, when this problem does happen, it can
be very annoying to the user, so the complexity was decided to be worth it.

the problem is: what happens if we do something (take a screenshot,
download a file, etc) but this operation takes some time to complete?

the application (screenshot utility, web browser, whatever) can approach
this in a few different ways. the old, simple way, was to start writing the
file immediately, and let it finish whenever it finishes. but then, what if
the user tries to open it or do something else with it while it's still
being written?

the first solution was to download the file somewhere else first, like say,
a temp directory or the browser's cache directory, etc. the downside to
this method is, what happens when the user goes to look for their file and
doesn't find it? they'll naturally conclude there's a problem and it's
obviously the web browser's (etc) fault.

so then they came up with this compromise: first we'll create an empty file
with the name of whatever we're creating, say abc.jpg for example. but
we'll start writing the _content_ of that file to abc.jpg.part, so the user
can't mess with it. then, once the write operation is complete, we'll
_move_ the .part file into the place of the original file. a move operation
almost always completes immediately, so there is basically no chance of
something happening in the middle to screw something up.

this scheme has been abstracted and put into software libraries so it's
much more widely used than it really needs to be.

While it shows up on Caja, but
> it doesn't show up in the terminal. Attempting to delete it gives me an
> error message telling me there is no such file or directory. It goes
> away if I reboot, but I don't know another way to get rid of it.
>
>
it shows up in Caja (whatever that is) because the file existed for a split
second. Caja was notified of the file's creation, but not of the file's
subsequent removal. this is why it doesn't show up in terminal: it's
actually not there. Caja may maintain some sort of cache or running tally
of which files exist, which it updates periodically. I would guess that if
you just wait a while, the .part file will probably go away. it may also be
possible to instruct Caja to refresh its index without rebooting. if it
were me, I would just ignore it. if it annoys you enough, you can take the
time to look through all the options in Caja to see if there is something
related to this, or search on terms like, Caja refresh file index or
similar.

-wes

Reply via email to