Delete yourself

Home Forums Tech Support Delete yourself

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #67230
    strider
    Participant

    Say that you have a file ‘stuff.tar.bz2’ and a folder ‘stuff’ and you want to delete the folder stuff before extracting the archive.

    In python you could do:

    Code:
    path = path_to_archive
    path = path[:path.find(‘.’)]
    delete_folder(path)

    Well the fun thing is, if your archive is located in ~/.local/share or some other dot directory, the erased path is your home folder!

    This is a friendly reminder to:

    1) Do a dry run before running code that deletes stuff
    2) Activate the Ctrl+Alt+Backspace to quickly kill your session if needed
    3) Setup Déjà Dup to backup your stuff daily or weekly

    #75299
    linuxgnuru
    Participant

    4) test on a virtual machine first

    #75301
    strider
    Participant
    linuxgnuru wrote:
    4) test on a virtual machine first

    That’s pretty much the same as doing a dry run except that replacing the delete function with a print statement is much quicker than having to setup your project on a VM.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.