Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 24 Oct 2014, 13:04
All times are UTC - 4
 Forum index » Taking the Puppy out for a walk » Suggestions
Trash Roxapp - Discussion Document
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 2 of 3 Posts_count   Goto page: Previous 1, 2, 3 Next
Author Message
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Thu 10 Apr 2008, 06:19    Post_subject:  

1. Because I want to make a script for the main trash menu that will parse all the info files and output a csv file (or something) with each trashed item on a new line. Then if I have lots of things in the trash I can use it to find the things I want quickly.
This way it will be simpler, otherwise the imaginary script would have to find the extension anyway.
Unfortunately I have run out of time at the moment Smile

2. We could, but why?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
dvw86


Joined: 04 May 2005
Posts: 636
Location: Washington State

PostPosted: Thu 10 Apr 2008, 13:37    Post_subject:  

Thanks,
I'll play with it and if it works well in Puppy 3, I will put it in Pupeee beta 5.
Back to top
View user's profile Send_private_message 
dvw86


Joined: 04 May 2005
Posts: 636
Location: Washington State

PostPosted: Thu 10 Apr 2008, 13:47    Post_subject:  

I forgot to mention that I pulled "shred" off of my Eeepc Xandros install. It works in Pupeee and I was going to add it to the trash application. This would give us a "Securely Empty Trash" option.
shred.tar.gz
Description  shred from Xandros
gz

 Download 
Filename  shred.tar.gz 
Filesize  19.14 KB 
Downloaded  529 Time(s) 
Back to top
View user's profile Send_private_message 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Sun 13 Apr 2008, 10:12    Post_subject:  

2. We could, but why?[/quote]because you have a line in there already for every file and folder. Alternatively pipe the du output through tail -1 so that you only show the total rather than loads of lines that contain nothing else other than a size.

The use case for showing the filenames.
Imagine I am searching for the deleted file foo.bar. I think it was buried several levels deep in one of four directory structures that I deleted yesterday. If you show all the filenames it makes it relatively easy to scan over to find the file.

_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send_private_message 
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Sat 07 Jun 2008, 22:37    Post_subject:  

Thanks Will - I only just saw that Sad
Obviously I didn't test carefully enough after adding that feature. I think it is best to go with piping it through tail -1, otherwise I think it gets overcomplicated. In a situation like you describe you'd probably better off searching for it some other way, e.g. with find.

With a little help from Muggins, here's a first version of the script I described before, to parse the info files and show a summary of everything in the trash:
Code:
#! /bin/sh

export MAIN_DIALOG='
<window title="All this is in the trash!" icon-name="gtk-delete">
<vbox>
  <tree>
    <label>Name|Location|Size|Deletion Date|Type|Extension|Had desktop shortcut?</label>
    <input>cat /tmp/trashitems</input>
    <variable>TREE</variable>
    <height>570</height><width>790</width>
  </tree>
  <hbox>
    <button ok></button>
  </hbox>
</vbox>
</window>
'

for i in ~/.Trash/*/Info; do cat "$i" | tr '\n' '|' | sed 's/Name = /\n/'; done \
| sed 's/Location = //' | sed 's/Size = //' | sed 's/Deletion Date = //' \
| sed 's/Type = //' | sed 's/Extension = //' | sed 's/Had desktop shortcut? = //' \
| sed 1d > /tmp/trashitems

cat /tmp/trashitems | sed -e 's/</?/g' | sed -e 's/>/?/g' > /tmp/trashitems

gtkdialog3 --program=MAIN_DIALOG --center
rm /tmp/trashitems

That bug you found is a bit unfortunate, as it means this script won't correctly list any folders deleted with that version of the Trash. Apart from that I think these are the only issues:
- It obviously won't include files deleted by old versions of the trash (before we implemented the info files), and won't properly list any that were deleted by one of the Dingo alphas or betas that had the info files, but without most of the information. I don't think we should try to make it backwards compatible though.
- It can't sort properly by size. I really like the "human-readable" sizes, so I'm trying to think of the best way of doing this. We could add another line to the info files (and this script), with the file sizes all in the same units (I think this is the best thing to do). We could instead add a button to sort by size, and the code would be rather more complicated. We could put the units at the front of the size. Any better ideas?
- We really need to modify the main trash script so that the "extension" field is blank for folders. I guess we just need to test for a folder before writing this field...
- If you sort by location, files deleted from the same directory don't seem to be in any logical order. I guess this is a reason to use the full path instead, as someone suggested.

Any comments?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Sat 07 Jun 2008, 23:55    Post_subject:  

Hmmm.
Two problems:
1. Unless there's a feature to sort numbers in gtkdialog, we'll have to have a button to sort by size, as even if we had all the sizes in the same units, a 1000KB file would be sorted before a 200 KB file.
2. I can't check for a folder before writing the extension, as I want that field blank for files without extensions as well. So I need to check for a . in the filename. How can I do that?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Tue 10 Jun 2008, 00:20    Post_subject:  

Darn!
I checked in Dingo, and only the version that creates info files with just the path and deletion date made it into 4.0
But I guess the good thing about it is that since backwards compatibility for the new summary feature is broken anyway, I can change the fields we put in the info files. So "Location" is now changed to the full path, and there is a new "Item" field to distinguish in the summary between deleted files with the same name.

Here it is!

There are also other minor tweaks from the version that didn't make it into 4.0, such as setting the default button in xmessage windows (not that this helps much in the stock Dingo, as you seem to need gxmessage to use the arrow keys to move buttons).

It should be trivial enough to run `rox deleted_item_appdir` when you right-click on a file in the summary, to get the same window as when you click on the item in rox (with buttons to delete/open/show/restore the file).
But I can't figure out how to work gtkdialog Sad

I also haven't implemented a "sort by size" button, as this is a bit beyond me too.
Trash.tar.gz
Description 
gz

 Download 
Filename  Trash.tar.gz 
Filesize  15.87 KB 
Downloaded  476 Time(s) 

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11121
Location: Arizona USA

PostPosted: Tue 10 Jun 2008, 00:36    Post_subject:  

I just noticed this topic. Embarassed
Speaking as a multisession DVD user, ideally the trash would contain a link to the session(s) where the (fragments of the) deleted file is (are). When I mount the DVD and click on the "deleted" file in the trash, at least the last version of the file should load. Better yet, every version of the file would somehow be loaded, so I could see the history of the file. I don't know how this would be done. It's my Christmas wish to Santa. Laughing

_________________
Puppy Help 101 - an interactive tutorial for Lupu 5.25
Back to top
View user's profile Send_private_message 
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Tue 10 Jun 2008, 02:32    Post_subject:  

I don't think it would be realistic to keep track of old versions of things from a Trash type program. I imagine it would be possible to have an easy way of comparing sessions, but someone capable would have to look into it.
I was recently looking for a gui simply to mount old sessions (on any multisession disc, not just a multisession disc of Puppy), which would be quite useful too.

Out of interest Flash, do you know what does happen when you trash something in multisession Puppy? Does the file get written again, taking up more space, or do the directions to it just change?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Wed 11 Jun 2008, 19:57    Post_subject:  

disciple; This command will output the files in a path from smallest to largest size.

ls -l1 (/PATH) | awk '{print $5}' | sort -g

Note that it's: ls -(lower case "L" & number "1")
Say if you need it sorted in largest to smallest, or a type of file, or a certain file extention.

To my knowledge, the Trash bin is a dir. /.Trash-0, just like /lost+found.
So when deleting a dir. or file, it's just moved to /Trash-0, which is in the pup_save. file.

Also... If you need help making gtkDialog work, I can help out, I've done a number of GUIs.

I don't know exactly what you're doing, looks like a "multisession file" history browser & loader GUI?
Back to top
View user's profile Send_private_message 
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Thu 26 Jun 2008, 18:07    Post_subject:  

Ah thanks - that makes it easier!
I wonder why I don't get notifications for this thread Crying or Very sad
Quote:
I don't know exactly what you're doing, looks like a "multisession file" history browser & loader GUI?

I'm not doing anything except studying for exams Smile
I do think that a multisession browser and mounter would be a very useful edition to puppy, but I personally won't be doing anything about it in the near future.
I believe you can mount an old session with the mount option `session=x` where x is a number. But I don't know how to list the sessions on a disc - maybe by parsing the output from cdrecord -vv? (or whatever the command is to output information about a disc with cdrecord)

If you want to help with a sort by size for the Trash, you would have to look at how it works. Trashed items each get their own subdirectory in ~/Trash, and the actual item is stored in a sub-subdirectory called "files". Information about the item is stored in a file called "info", so the summary gui just parses all these "info" files.
To sort by size I guess it would be easiest to use ls to sort all the directories in ~/Trash by size, and pipe the result through the command that parses the "info" files.

-----------------------
Man I'm stupid.

I just realised that by far the biggest improvement we could make to the Trash is to add a -help option to the right-click menu. That might help at least some of the people who don't realise that deleting a file makes it disappear forever, and that you need to drag files onto the trash to trash them.
We'll have to update the help file a bit though - I'll get onto it in a few weeks when I have the time, unless someone else does it.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Thu 26 Jun 2008, 18:10    Post_subject:  

Google turned up msinfo from the cdrdao distribution, which might be what we're after for listing sessions.
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11121
Location: Arizona USA

PostPosted: Fri 27 Jun 2008, 00:01    Post_subject:  

Ok, I see that once again my ignorance has been the source of confusion (my own, if no one else's. Smile ) I assumed that the immediate effect of deleting an item is to move it to the trash directory (along with its dependents, I suppose.) I must confess that I've never used Puppy's trash. I guess it makes sense that only items that have been dragged (or otherwise deliberately moved) to the trash will be found in the trash, while deleted items bypass the trash and go straight to the bit recycle bin. The situation is a bit different if you run Puppy from a multisession DVD. Anything written on a DVD cannot be erased, so deleting an item can only remove it from Puppy's file system index or directory or whatever you call it. (Pardon me while I show off my ignorance again.)

What I'm suggesting is that, for multisession Puppy at least, items when they are deleted be moved to the trash directory for a while, then removed from the trash if they aren't accessed for a certain time, or perhaps number of reboots. Putting an item in the trash means it will not be saved when Puppy next shuts down, nor reloaded into RAM the next time Puppy boots. However, a link to its location on the DVD would be in the trash index. Of course, I realize that this is only wishful thinking because I have no idea how to implement it. Crying or Very sad

_________________
Puppy Help 101 - an interactive tutorial for Lupu 5.25
Back to top
View user's profile Send_private_message 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Fri 27 Jun 2008, 02:03    Post_subject:  

Possiblly in multisession mode the contents of the trash could be moved to archive before the session is written to disc. This does mean that the trash would not show deleted items from previous boots. Maybe it should be able to search through all the archive directories as well.
_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send_private_message 
disciple

Joined: 20 May 2006
Posts: 6449
Location: Auckland, New Zealand

PostPosted: Fri 27 Jun 2008, 03:37    Post_subject:  

I don't think that makes sense HW. You might as well just delete the items, and then compare sessions to find deleted items.
--EDIT--
No, there are two problems with that:
- firstly if the file is new (not already saved in an old session), it will really be gone forever (not even photorec could save you). Also, a file from another filesystem would be gone forever (but photorec might save you).
- secondly items that you might want to recover (that you would normally trash) would not be distinguished from items that you know you don't want (so would normally delete). Some "power-users" wouldn't like this, but normal users would probably love it Smile
--/EDIT--

How much space would you actually save by archiving trashed items anyway?
I may misunderstand how the multisession system works, but I don't think if you trash a 25MB file it will take up an extra 25MB in your latest session. I think the filesystem will refer to the file in its original location in an old session. So it would only be taking up extra space when you move to a new disc. Can anyone confirm this? I think that's what you were saying Flash?

--EDIT--No longer relevant--
In the end, you don't really NEED the trash for a multisession system, as deleted files aren't gone forever like in a normal system. You either need what Flash suggested (a record of which files were deleted when), which I think is complicated and unnecessary; a way of comparing sessions (this would be quite entertaining too); and/or a way of mounting old sessions and searching for files in them.
Or there may be no real disadvantage to using the Trash like it is Smile (except if you trash large items from a different filesystem).

I suspect if you were running a multisession puppy, and booting at least once a day, you would probably want an easy way to compare sessions rather than just a gui for mounting them. Maybe all you would need is Xfdiff...
--/EDIT--

Quote:
I assumed that the immediate effect of deleting an item is to move it to the trash directory
If Flash assumed that, we certainly can't blame newbies for doing the same Smile
I think we need to start an education program somehow. Maybe we could hack the forum so that pop-up windows tell you how how to use the trash every time you load a page Smile

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 2 of 3 Posts_count   Goto page: Previous 1, 2, 3 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Taking the Puppy out for a walk » Suggestions
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0988s ][ Queries: 12 (0.0055s) ][ GZIP on ]