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 Sat 25 Oct 2014, 16:04
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Deleting files and trash etc
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
tytower

Joined: 24 Feb 2007
Posts: 440
Location: Green Island Cairns for the winter

PostPosted: Wed 16 Jan 2013, 16:17    Post_subject:  Deleting files and trash etc  

When I right click I get a "delete" option to delete a file .
I would like all deleted files to go into the trash bin for say, a day , so that I could recover a file that I had deleted in error.

In fact noting the errors I have seen in Puppy where groups of files just disappear without explanation( probably because of something I have done anyway) it would be prudent to make all deleted files pass through trash anyway with an option to choose when the trash is emptied.

Can this be done at the moment?

_________________
Neither my Family nor my Property are Government issues. Governments should do what they were designed to do Manage the larger issues best done by Governments
To stop corruption give them 3 times the penalty. Get their agreement on first employment.
Back to top
View user's profile Send_private_message 
Hotdog


Joined: 29 Sep 2011
Posts: 109
Location: Georgia USA

PostPosted: Wed 16 Jan 2013, 21:05    Post_subject:  

tytower,

Most Puppies have Trash as an option in the right-click menu. What version of Puppy do you have? And, what type of installation? Maybe we can figure out how to get it back.

_________________
Puppy 528, Full Install
Back to top
View user's profile Send_private_message 
tytower

Joined: 24 Feb 2007
Posts: 440
Location: Green Island Cairns for the winter

PostPosted: Thu 17 Jan 2013, 03:38    Post_subject:  

I have 5.4.2 but I think you mean in Rox filer a trash can comes up next to the "delete" command . When you use this it does not go into trash it is deleted forever..I would like a trash can option on that right click menu at least but it would seem better to me to be able to trash it on all deletes and don't actually lose the file until a time has been reached or the user intentionally removes them to clear up space.
_________________
Neither my Family nor my Property are Government issues. Governments should do what they were designed to do Manage the larger issues best done by Governments
To stop corruption give them 3 times the penalty. Get their agreement on first employment.
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Thu 17 Jan 2013, 09:00    Post_subject:  

You could try to play with this, but frankly I haven't used it since then and don't know if Darkcity has explored the subject deeper.

Regarding ROX-Filer's Trash - it depends on Puppy version.
Lucid, for instance, has it, but Slacko/Precise haven't.

If you'd like to add Trash to your right-click menu:

1. Safe, but inconvenient method:
Right-click a file/folder -> Customize Menu... -> drag'n'drop Trash icon from desktop into opened dir (create relative symlink).
It has to be repeated for each filetype.

2. Easy, but possibly unsafe method (I haven't had any problems with it, but it's better to make a backup before proceeding):

Code:
#! /bin/bash

# Adds/removes Trash to the context menu

OpenWith_PATH="$HOME/.config/rox.sourceforge.net/OpenWith/"

case "$1" in
  "add")
    # Creates missing folders using 'globs' file contents
    for i in `cat /usr/share/mime/globs | grep ":" | cut -f1 -d ':' | tr '/' '_' | uniq`; do
      [ ! -d "$OpenWith_PATH"".""$i" ] && mkdir "$OpenWith_PATH"".""$i"
    done
    mkdir "$OpenWith_PATH"".inode_unknown"
    # Creates symlink to the Trash in every folder
    for i in `find "$OpenWith_PATH" -maxdepth 1 -type d -iname ".*"`; do
      [ ! -L "$i/Trash" ] && ln -s /usr/local/apps/Trash "$i"
    done
  ;;
 
  "remove")
    # Removes every symlink to the Trash and removes folder if empty
    for i in `find "$OpenWith_PATH" -maxdepth 1 -type d -iname ".*"`; do
      rm "$i/Trash"
      [ ! "$(ls -A "$i")" ] && rmdir "$i"
    done
  ;;
esac
 
exit

Save it in /root/my-applications/bin/ as, eg. add_remove_trash.sh and:
a). To add Trash:
Code:
add_remove_trash.sh add

b). To remove Trash:
Code:
add_remove_trash.sh remove

It will automatically create Trash entries for each known and unknown filetype + folders.

EDIT: Small correction in code.

HTH
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
tytower

Joined: 24 Feb 2007
Posts: 440
Location: Green Island Cairns for the winter

PostPosted: Thu 17 Jan 2013, 17:54    Post_subject:  

Works brilliantly . Thanks very much !

How would I get trash to emty automatically say in 2 days time ?

_________________
Neither my Family nor my Property are Government issues. Governments should do what they were designed to do Manage the larger issues best done by Governments
To stop corruption give them 3 times the penalty. Get their agreement on first employment.
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Thu 17 Jan 2013, 20:01    Post_subject:  

tytower wrote:
How would I get trash to emty automatically say in 2 days time ?

Hmm, perhaps something like this:
Code:
#!/bin/bash

HOW_OLD=2      # in days

while true; do
  find /root/.Trash -maxdepth 1 -and -not -name .Trash -ctime +"$HOW_OLD" -print0 | xargs -0 rm -rf
  sleep 1h
done

(save it as, eg. purge_trash.sh (no spaces in filename!) in /root/Startup/ and click to perform initial launch)

This script should search (every hour) for files/folders older than 2 days in /root/.Trash/ and delete them (if any).
But this one is really barely tested, so please be careful...
(btw, you can replace -ctime with -mmin to use minutes instead of days, but then adjust also the 'sleep' command)

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
tytower

Joined: 24 Feb 2007
Posts: 440
Location: Green Island Cairns for the winter

PostPosted: Fri 18 Jan 2013, 02:24    Post_subject:  

Can't be careful if I don't test the script so that warning covers your arse so thats good for you but it is pointless for me . . No Probs I'll give it a run for a few days and if my machine explodes I promise not to whine..

Thanks

_________________
Neither my Family nor my Property are Government issues. Governments should do what they were designed to do Manage the larger issues best done by Governments
To stop corruption give them 3 times the penalty. Get their agreement on first employment.
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Fri 18 Jan 2013, 04:33    Post_subject:  

Good point - to cover also your's, you can try this instead:
1. Stop the existing script (ps | grep purge_trash and kill its process)
2. Create a directory /root/Moved_From_Trash
3. Replace the appropriate line with:
Code:
find /root/.Trash -maxdepth 1 -and -not -name .Trash -ctime +"$HOW_OLD" -print0 | xargs -0 mv -t /root/Moved_From_Trash 2>/dev/null

4. Re-launch the script
This way you can see if files that are supposed to be deleted are the good ones for sure.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.

Edited_time_total
Back to top
View user's profile Send_private_message 
tytower

Joined: 24 Feb 2007
Posts: 440
Location: Green Island Cairns for the winter

PostPosted: Fri 18 Jan 2013, 05:21    Post_subject:  

All done I'll let you know

Should that be "All of importance I carry with me "?

_________________
Neither my Family nor my Property are Government issues. Governments should do what they were designed to do Manage the larger issues best done by Governments
To stop corruption give them 3 times the penalty. Get their agreement on first employment.
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Fri 18 Jan 2013, 06:34    Post_subject:  

Great! But you didn't tell me and I forgot to ask, and assumed that you've chosen the 'right-click -> Trash' method, not libtrash. Is that correct?
If so, all's fine. If not, the script simply won't work.
Quote:
Should that be "All of importance I carry with me "?

Could be. I'm not an expert in Latin (far from that), but according to different sources: "All that is mine I carry with me" or "I carry all my things with me". But since I carry them, they must be somehow important. Wink

EDIT:
I put -mmin instead of -ctime in the above line of code (leftover from testing).
Corrected now. Please replace it again, or all files from trash will be removed every hour. Sorry for inconvenience.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
tytower

Joined: 24 Feb 2007
Posts: 440
Location: Green Island Cairns for the winter

PostPosted: Fri 18 Jan 2013, 17:29    Post_subject:  

Yes I left that (-mmin) there to prove it and it worked fine .
I'll have to look a bit closer at this though .
The new directory receives everything that was in the trash can so when opened the choices to open restore ,info ,delete,look inside etc come up . Something resets the trash can lid too when it is emptied so Ill try find that and add a line.

If you look inside you get all the "Appinfo.xml" link and "AppRun" file and "info" file for each trashed file and a Directory for the trashed file itself. I have yet to work out what is happening here but all that seems as it should be I suppose but the size of trash is increased by these as you tresh stuff. About 4.3K is added for each file put in there

Certainly it seems to empty Trash properly though as it should . Ill set up a better test over a longer time and let you know.
Thanks

_________________
Neither my Family nor my Property are Government issues. Governments should do what they were designed to do Manage the larger issues best done by Governments
To stop corruption give them 3 times the penalty. Get their agreement on first employment.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
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.0903s ][ Queries: 12 (0.0199s) ][ GZIP on ]