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. :beat-up: 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.)
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.
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/
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/
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?
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:
‘mv’ is for moving files. Renaming is essentially the same thing since
you move it from /path/to/source.ext to /path/to/dest.ext. Unless you
actually change filesystems your inode is the same for either a move or
rename operation.
There IS a ‘rename’ command as well, and it is very good at renaming
files, but it is made to do so for multiple files at a time (see the
manpage for details).
Good luck.
chief sealth wrote:
> palladium;2115147 Wrote:
>> but, i can’t see why it move a file to your home’s root when it should
>> (imo) give an error: “~/.Trash does not exist” or similar… ??
>
> “mv” is used for renaming files. There is no “ren,” “rename,” in *nix.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
The “trash” has some magic to it… how else can it know to ‘Restore’ one
file to your Desktop and another to a directory within your desktop?
These metadata (stored as ‘please try again’ mentioned) are why simply
moving things to ~/.Trash will not make everything happy. I have a
~/.Trash still on my system for my user, though nothing is ever in it.
Good luck.
palladium wrote:
> chief sealth wrote:
>> All that does here is rename the file and move it to the user’s root
>> directory.
>
> hmmmm…i guess there is a difference then in the layout of (what?)
> kde4 on 11.2 vs what i’m running (kde3 on 10.3)
>
> but, i can’t see why it move a file to your home’s root when it should
> (imo) give an error: “~/.Trash does not exist” or similar… ??
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
You’re right! I guess in most of the documentation I’ve read, mv has been the most commonly used. Somewhere along the way I must have had it ingrained in my head this was the only way.
Yes… and the say you need rename you will LOVE it.
Good luck.
chief sealth wrote:
> ab@novell.com;2115151 Wrote:
>> There IS a ‘rename’ command as well, and it is very good at renaming
>> files, but it is made to do so for multiple files at a time (see the
>> manpage for details).
>
> You’re right! I guess in most of the documentation I’ve read, mv has
> been the most commonly used. Somewhere along the way I must have had it
> ingrained in my head this was the -only- way.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
ab@novell.com wrote:
> The “trash” has some magic to it…
i see now it is more complicated than i thought…however i know mv
is short for move, and it 1) moves, 2) renames 3) moves and renames,
and 4) deletes (well, actually only puts stuff in the magic trash)…