Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: dfm trash can< Next Oldest | Next Newest >
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Jan. 02 2008,10:45 QUOTE

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
Back to top
Profile PM 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Jan. 02 2008,17:44 QUOTE

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??
Back to top
Profile PM 
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Jan. 02 2008,22:20 QUOTE

originally the script would move the files, but i was quite surprised to find that dfm allows you to drop files onto a shortcut!
Back to top
Profile PM 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Jan. 04 2008,10:38 QUOTE

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.
Back to top
Profile PM 
lucky13 Offline





Group: Members
Posts: 1478
Joined: Feb. 2007
Posted: Jan. 04 2008,12:45 QUOTE

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


--------------
"It felt kind of like having a pitbull terrier on my rear end."
-- meo (copyright(c)2008, all rights reserved)
Back to top
Profile PM WEB 
8 replies since Jan. 02 2008,10:45 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: dfm trash can

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code