How to *really* remove a file?

Jon LaBadie ubu at labadie.us
Sat Jan 7 04:21:58 UTC 2023


On Thu, Jan 05, 2023 at 10:56:50AM +0100, Bo Berglund wrote:
>On Thu, 5 Jan 2023 08:24:46 +0000, Chris Green <cl at isbd.net> wrote:
>
>>On Thu, Jan 05, 2023 at 09:19:11AM +0100, Bo Berglund wrote:
>
>>Why would you want it otherwise?
>
>Well, one case is to make an edited version of a video replace the un-edited
>version when the user has already started viewing the un-edited video file.
>Basically remove access to the unedited video also for an already started
>player. Then save the new video to the old name.
>
>This seems only to be possible if I write zeros to the file, or mybe this is not
>even possible?
>
>Like thís:
>
>mv originalfile newfile  #To free up the file name
>mv editedfile originalfile  #Replace the original file with edited file
>echo "0" > newfile #Reset the moved file to contain 0.
>
>The last command should stop any viewing from continuing, right?

I don't know, how much of the video does the application have cached in
it own memory?

BTW echo "0" > newfile  creates a 2 byte long file.
You can use redirection with out a command, i.e.
just > newfile to truncate the file.

jl
-- 
Jon H. LaBadie                  ubu at labadie.us



More information about the ubuntu-users mailing list