dfm trash can


Forum: DSL Tips and Tricks
Topic: dfm trash can
started by: humpty

Posted by humpty on Jan. 02 2008,10:45
here's another one.

a trashcan script for dfm.

1. put the script in a folder where to store your trash (probably not in ramdisk). important: the folder can be called anything e.g 'mybin' but the script MUST be called 'trash'.

2. make it executable (e.g chmod 755 trash).

3. navigate to 'mybin' using the dfm '/' icon and create a shortcut link by dragging 'mybin' to the desktop while pressing 'shift'.

files can now be dragged into this 'mybin'

double-click 'mybin' to open it.
double-click 'trash' to delete the files forever.

optionally change the icons for 'mybin' and 'trash' to trashcan.xpm.


(disclaimer: this software deletes. use at your own risk)

Code Sample
#!/bin/lua

alist = {}

lcmd = io.popen ("ls -1a", "r")
if (lcmd) then line=lcmd:read()
while (line) do
 if (line ~= "." and line ~= ".." and line ~= "trash") then
  table.insert (alist,line)
 end
 line=lcmd:read()
end
lcmd:close ()
item = alist[1]
else item = nil
end

i=1
while item ~= nil do
os.execute ("rm -rf "..item)
i=i+1
item = alist[i]
end


edit: just made it smaller

Posted by jpeters on Jan. 02 2008,17:44
Thanks humpty.  Hope nobody forgets to place the script in a folder (e.g., puts the script on their desktop and clicks it. :)

note: maybe a trash that just deletes a dragged file would be safer
edit: or creates/sends to a trash folder for later deleting??

Posted by humpty on Jan. 02 2008,22:20
originally the script would move the files, but i was quite surprised to find that dfm allows you to drop files onto a shortcut!
Posted by jpeters on Jan. 04 2008,10:38
Quote (humpty @ Jan. 02 2008,17:20)
originally the script would move the files, but i was quite surprised to find that dfm allows you to drop files onto a shortcut!

Shortcuts can act strange.  For example:

You create two files, an app with an ftp path and one with some work:
ftp mypath < someProcedure,files

Link the two files into the desktop apps folder, and make the app drag & drop , so you can drag the work file onto the app.

Although both  are linked  to another location, the list of files in the  work file will have to be in the apps folder to work.  Putting the full path in the  work file doesn't help, either.

Posted by lucky13 on Jan. 04 2008,12:45
Quote
note: maybe a trash that just deletes a dragged file would be safer

That's kind of the idea behind my shredder. Requires intent, zeros out space instead of rm.
< http://www.youtube.com/watch?v=F-Kkqi_JrK4 >

Posted by jpeters on Jan. 04 2008,17:10
Can hardly make out the code...it's a blur. Could you post it? Thanks.
Posted by lucky13 on Jan. 04 2008,21:42
Going off top of my head (no flash on this computer)... rewrite 3x (default is 25x), zero-out, remove, verbose output in terminal. You can add "f" to the first group of flags to force despite permissions, change 3 to suit your tastes/CPU speed/paranoia level.

Code Sample

#!/bin/bash
exec aterm -T shredder -e shred -uvz -n 3 "$@"

Posted by jpeters on Jan. 04 2008,23:02
That's quite interesting, lucky.....it cleared the text from files dragged onto it while leaving the icon;  deleting one eliminated the entire group.  I did a google search about aterm shredder and learned about aterm insurance's free paper shredder.

Edit:  I forgot to use the <esc> key to renew the folder....they're gone (that makes more sense!)  Thanks.   (works likes windows trash....drag a group of icons with <shift> and they're gone.  Nice!  
Perhaps someone can do a Wiki posting that our trash is now windows complient. )

Posted by lucky13 on Jan. 04 2008,23:33
Try right-click Update in your dfm box and your icons will disappear.

Edit: Didn't see your edit when I posted.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.