Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: rm to wastebin?

  1. #1
    Join Date
    Jun 2008
    Location
    Hessia
    Posts
    303

    Question rm to wastebin?

    Is there a way to delete files on the commandline that uses the KDE-Wastebin?

    It appears that I never ever need the KDE4 Wastebin for files that I deleted through Konqueror or Dolphin. It is only when I delete files on the konsole with rm that I wish I could undelete them. It always happens like that, mostly by being in the wrong directory or using a wildcard when I should not have.

    (I don't have any erroneous deleted file right now, and I do have plenty of backups, but I just wonder whether there is something better than rm to use generally on the commandline.)

  2. #2

    Default Re: rm to wastebin?

    you can make an alias rm='rm -i' to avoid mistakes. It will prompt before removal.
    Create the file ~/.alias if it doesn't exist and write this line in it:
    alias rm='rm -i'
    I think it is sourced by ~/.bashrc. Open a new terminal and type: alias to display the currently defined aliases.

  3. #3

    Default Re: rm to wastebin?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Close... your case for the commands is all wrong. You CANNOT has "ALIAS
    RM='RM -I'" and expect it to work as neither ALIAS nor RM are commands.

    alias rm='rm -i'

    Good luck.





    please try again wrote:
    > you can make an alias rm='rm -i' to avoid mistakes. It will prompt
    > before removal.
    > Create the file ~/.alias if it doesn't exist and write this line in
    > it:
    > ALIAS RM='RM -I'
    > I think it is sourced by ~/.bashrc. Open a new terminal and type:
    > *alias* to display the currently defined aliases.
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJLah9fAAoJEF+XTK08PnB5ZPcP/iSk4RGY41Leu0lADVdDpC5P
    p796fem4plOxTPDGpBLnecTiWhDuqqrL8K2Nhqx/iGKmq/4Wp56kHb0HCMrm5jjD
    TsH0kUH1ZhQ83cXJH2cwbVBk4s9aUhXV7wZPUydIiwZ1+9wn5V588aKl8CaWGi5G
    MV2f1v4oRciRKIOGDagQWNyGkB3uFRjMBHiKnqyF/3lJ2hvPByc6silOxuV/pvU0
    w76zQ8AqL7uvtTWmxLWVF720QPu6QADTqusbyFiP0okwl4CDnrqWq+Gh4kQmVZtE
    sZXyHkslaUx/MK78WFPb23v4aWvT/DDmaP8ZcE55CAHBtrGuBQ3xdB2ChRDgWbQU
    MJ38zmgRVBs3zuSGkUuOB/o5uRZ47lcJfoY836Q5j16xVzgiLorIDT4fP7Im6/zp
    yPQpB0d9B1Etc9wKofCaOTQ+3Oa7snKClisGspy7sYGqiVXW/bSaJS05lbsPx6jT
    7oWdpKPQP0Lgs74tfcjUhIx9R/QCphNrP2D0CU57wiJM9v8jF4Vq/jqnGfRT3wTh
    SMQm65PwQ5wI+wHF+3cQOaU3Tsdd74JFPvzJLnV6IJ+01CuKXZKiYKhr0T8x6gSr
    GcgDDK5iNeoGlba38Vwc8GxgN0qJT+flKmHI3y+jRvFnuDZHyen8tH1/kd1UslRB
    hMRVHg/Yde4TadxO7UBJ
    =zvJe
    -----END PGP SIGNATURE-----

  4. #4

    Default Re: rm to wastebin?

    Quote Originally Posted by ab@novell.com View Post
    Close... your case for the commands is all wrong. You CANNOT has "ALIAS
    RM='RM -I'" and expect it to work as neither ALIAS nor RM are commands.
    Definitely! But I never wrote this commands it all caps (?!). I just highlighted that line in bold. Is that a browser display issue on your side?

    What do you read here :
    alias rm='rm -i' ?
    and here :
    alias rm='rm -i' ?

    The first line should be in bold (not in caps!)

  5. #5

    Default Re: rm to wastebin?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    They do not have bold at all.... I'm not using a web browser to view the
    forums. Sorry about that.... the NNTP showed the characters in caps,
    though now they do not with your recent example (first had asterisks on
    either side, second did not).

    This may be a conversion thing between the web forums and the NNTP
    applications.

    Good luck.





    please try again wrote:
    > ab@novell.com;2114854 Wrote:
    >> Close... your case for the commands is all wrong. You CANNOT has
    >> "ALIAS
    >> RM='RM -I'" and expect it to work as neither ALIAS nor RM are
    >> commands.
    >>

    >
    > Definitely! But I never wrote this commands it all caps (?!). I just
    > highlighted that line in bold. Is that a browser display issue on your
    > side?
    >
    > What do you read here :
    > *alias rm='rm -i'* ?
    > and here :
    > alias rm='rm -i' ?
    >
    > The first line should be in bold (not in caps!)
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJLalKQAAoJEF+XTK08PnB5T4kP/R7SfO2IfQBpUelg0URsOq73
    PnwkZzks9ZRaQGZj5CWvYgIXoogtpdt/4FcuEKjUphpwQ28Vn2EE7Qzbr0nGhEfY
    P8ktmbqsCE/k/JhDYns+IIMbvASBt9bVcreQ6b10Pwt5+rGHN7WoGppwDbTopEIe
    Odw2dVbAJyXCt3eFGP3wKOo/cpct2z2VQDOS/rbhnHgDw2LlV1q2ZQf5NjkRJ369
    lID6wCRUuwwFSgudoFypzO+FLqttDgYlivtEfHNINhHofQInXL+hnOE/SpOwWBQ/
    A+FAPyGEKYTXsB6Bvbs9G3msTCJOB7IvjXkpMbSBbERs079OtLbgx2OV0EbEpO3P
    N/vHQqY0SWMuJw35z9BdfOHR93d38Usbna2QenW20gSlDgC0aJ+iTiUhVDf3sSb9
    Ej/d0pVI/zl0Wi93MCatNek+PjK/k2Lu8ul/U/XIS9R2V29U65LsdBE/6qOBd+xr
    U8KJHfEjUMPxlkzeez53MIXwvJKuEpMzQN+JDqQQOnymZ37gtGoRVzwy5DlP9USd
    7myX/Z/FNqssIhTuxxqvFNKFiP5eHwGThHf5IoMtwOdXYLG4ydcL0usBtmvPIpCd
    wH1JbV5rdlHeKz5hm9AJCrUZswDBNYenOAcyLUHFh/REy4HLMX+q+UFI4JUrsgGw
    99dxYzgNTupgtLpJfX9f
    =2/zm
    -----END PGP SIGNATURE-----

  6. #6
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,044

    Default Re: rm to wastebin?

    On Thu, 04 Feb 2010 04:52:33 +0000, ab@novell.com wrote:

    > This may be a conversion thing between the web forums and the NNTP
    > applications.


    It is a known issue. Happens from time to time.

    Jim



    --
    Jim Henderson
    openSUSE Forums Moderator

  7. #7
    palladium NNTP User

    Default Re: rm to wastebin?

    please try again wrote:
    > you can make an alias rm='rm -i'


    couldn't you (instead of using rm) use move to send stuff to your
    trashcan, like:

    mv [/path/filename] ~/.Trash

    if you wish, you may add -i (after mv) to have it prompt you for a y
    (yes) prior to execution..


    and, i guess you could make a tiny script allow you to just type

    mvT [/path/filename]

    --
    palladium

  8. #8
    Join Date
    Jun 2008
    Location
    Hessia
    Posts
    303

    Default Re: rm to wastebin?

    Option -i is certainly not what I want, since the comamndline is meant to be faster, not slower than point & click, so I pretty much always use -f instead. Also, it is usually a day later that I realize the wrong thing has gone.

    I tried a script to move files to ~/.local/share/Trash/files/ but then they do not show up in the Trashcan, which is inconvenient. Worse, I doubt that they get automatically deleted from the Trashcan once they expire the Trashcan's set expiry date.

    So isn't there a shell script or DBUS-something that can trigger the same functionality from the commandline as deleting does in Dolphin?

  9. #9

    Default Re: rm to wastebin?

    Here's what happens when you move a file to the trashcan under KDE. Let's take the file /home/stan/doc/hello as example.

    Moving this file to the trashcan will:
    • create the directories /home/stan/doc/.Trash-0/files and /home/stan/doc/.Trash-0/info if that don't already exist. Notice that /home/stan/doc/.Trash-0 is a hidden directory.
    • move the file /home/stan/doc/hello to /home/stan/doc/.Trash-0/files
    • write a relative path and deletion date in the file /home/stan/doc/.Trash-0/info/hello.trashinfo


    It's not difficult to write a script which would do that. And I'm sure many people did already. Just googled and found that page:

    Command line to trash - Unix Linux Forum - Fixunix.com

    I haven't looked at it. I'm sure you will find others (or write your own ... )

  10. #10
    palladium NNTP User

    Default Re: rm to wastebin?

    STurtle wrote:
    > I tried a script to move files to ~/.local/share/Trash/files/


    why would you pick that path when what i wrote actually works:

    mv [/path/filename] ~/.Trash

    well, it works here (file disappears where it was and reappears in
    Trashcan), i have no idea why it wouldn't work there..

    as for automatic emptying, no idea..

    --
    palladium

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •