Find Files in -specific- folders...

Post here if you are a new Porteus member and you're looking for some help.
tb01
White ninja
White ninja
Posts: 12
Joined: 23 Aug 2012, 16:42
Distribution: P-MATE (all) x32/x64, debian
Location: -happydale-

Find Files in -specific- folders...

Post#1 by tb01 » 21 Oct 2012, 06:21

First, THANK YOU SO VERY MUCH for picking up the previously dead Slax project! I -really- LOVE Porteus, and find it has become my new favorite distro. While providing new capabilities, fixes to previously (Slax-variety) non-working features and updated software (YAY!!!), it (unfortunately) seems to retain some of the frustrating idiosyncrasies I remember from Slax.

In perusing the user forum posts, it appears Porteus is quite well supported and issues appear to be addressed quickly and accurately. THANK YOU to everyone involved for making this wonderful product available to those of us who so desperately need -this- =very= solution!

As an interested user wanting to see Porteus become even better still, I need help with a couple of current items, as follows:

I often wish to create a small module of just the files changed within the last couple of hours or so (customized settings). I invoke Find Files/Folders app, Named: "*" and Look in: "/etc;/home;/media;/mnt;/opt;/root;/usr;/var" with Include sub-folders checked. This always produces the error "Could not find the specified folder," no matter how I specify list of directories to search (commas, colons, semicolons, spaces).

Trying to 'help myself,' I click the Help button, producing -another- error: "Could not launch the TDE Help Center: Could not find service 'khelpcenter'."

Is there some viable way to assemble this list, without including files from /dev, /proc, /sys (and so on)?

Is there some way to get actual help to appear from the help button shown in the application?

Thanks in advance.

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Find Files in -specific- folders...

Post#2 by fanthom » 21 Oct 2012, 08:11

hello tb01,

i'm glad that you like our project :)

while i'm mainly a cli guy i'll give you solution in the shape of a simple script:

Code: Select all

#!/bin/sh

# folders to check (tweak for your needs):
folders="/etc /home /root /opt /usr /var"

# gather all files in one place:
mkdir /tmp/backup_folder
find $folders | xargs -I {} cp -a --parents {} /tmp/backup_folder

#create the module on your desktop with current date:
dir2xzm /tmp/backup_folder $HOME/Desktop/changes-`date +"%m-%d-%y"`.xzm
rm -r /tmp/backup_folder
save it as changes_backup.sh and make executable, then run :)
Please add [Solved] to your thread title if the solution was found.

tb01
White ninja
White ninja
Posts: 12
Joined: 23 Aug 2012, 16:42
Distribution: P-MATE (all) x32/x64, debian
Location: -happydale-

Re: Find Files in -specific- folders...

Post#3 by tb01 » 21 Oct 2012, 14:02

Hi fanthom,

Thanks for your speedy reply. As stated above, I also need //modification time// selection, specifically.

This is horrifically frustrating. I've now wasted *many* hours searching for help information which IS NOT ACCESSIBLE from clicking THE HELP BUTTON, and studying never-ending man pages for 'find' and 'xargs'. I've only managed to achieve a *thumping* migraine and a familiar return to an exceedingly high level of confusion and upset.

Somehow, I keep believing I can receive a viable reply to a forum post for help -- despite all evidence to the contrary. Failing that, I find myself believing I will be able to locate for myself, the obscure and buried information I need, by forcing my mind repeatedly through a disturbingly overwhelming mass of disparate, disorganized and irrelevant information.

Help text should appear when the help button is clicked, and it should be actually helpful; anything else represents a bug, or bad software, even if such response is dependably consistent among nearly all Linux distros.

Those man pages are -anything- -but- intuitive, clear or useful. Though I understand and agree with the flexibility and precise control available through many options to nearly every possible command, the typical construction, format and inconsistency of man pages is only -potentially- useful as a reference for expert-level users, and only for those able to mentally map the specific relevant section thereof. Reading even one man page in its entirety is an act which can only result in turning one's previously bright, eager and enthusiastic grey matter into an exhausted, dull-brown, lumpy and life-less pudding.

I had to ask... and I do appreciate your reply. It seems my desire to produce a viable and stable installation from which to learn Linux, is instead providing only the ultimate exercise in futility. Maybe I should instead focus on my other technical and engineering interests, keep a basic LiveCD around for paying bills and checking email, and forego any hope of contributing to the development of an operating system which apparently holds nothing rewarding or beneficial for me. No one able to answer my questions takes the time to comprehend what I ask, and the barely-'eight percent viable' responses I typically find have taken their toll on my desire to be any part of the Linux Movement. Maybe I expect too much. Or maybe I'm just having a really bad day.

I desperately need to do -anything- else right now. Hopefully later, maybe in a few days, I'll be able to come back to this. It just continues to feel like the most frustrating, all-consuming 'waste of valuable time and good effort' -- at least since I kicked M$ crapware out of my life. Sorry I'm having such a hard time with this.

User avatar
wread
Module Guard
Module Guard
Posts: 1255
Joined: 09 Jan 2011, 18:48
Distribution: Porteus v5.0-kde-64 bits
Location: Santo Domingo
Contact:

Re: Find Files in -specific- folders...

Post#4 by wread » 21 Oct 2012, 16:31

Maybe you should search folders one at a time stating the starting folder only; our system is so fast and in that way it works for me! It should work fo you too, without migraene...

Welcome an board!
Porteus is proud of the FASTEST KDE ever made.....(take akonadi, nepomuk and soprano out and you will have a decent OS).
The Porteus Community never sleeps!

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Find Files in -specific- folders...

Post#5 by brokenman » 22 Oct 2012, 11:51

The TDE help centre is not functional which is partly my fault as it was not compiled in. Perhaps when the next final version of TDE is released (and size is not adversely affected) i will compile in the help centre.

To find the files that have had a time stamp change you can use the built in script: changes-time from a terminal.

The switch you are looking for with 'find' is:

Code: Select all

find $folders -mmin 3 -type d -name "*"
This will give you all changed files within the last 3 mins.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
bigbass
Contributor
Contributor
Posts: 151
Joined: 13 Jan 2012, 14:35
Distribution: slackware 14

Re: Find Files in -specific- folders...

Post#6 by bigbass » 22 Oct 2012, 15:59

both fanthom and brokenman offered nice snippets to get recent files
thanks

I often wish to create a small module of just the files changed within the last couple of hours or so
I will take a different spin on this something that caught my attention
and I think it could be useful too

Joe

So here's how to do it run this script first
it can be run when you want to start recording the session from this point on
but nothing gets saved until you run the second script it just sets a time stamp
file


Code: Select all

#!/bin/bash

# a way to make a "Porteus module"  of recent changes
# user defined from a start time reference point
# until the user decides to stop recording
# so this is a unique between two time points save file
# Joe Arose bigbass   tested on slackware 14 with mksquashfs installed

#------------------------------------------
# Pre step set up the reference point
#------------------------------------------
# this is done just once !

# this needs to get created first lets say after X is started
# or when you want to start recording from this point on

cd $HOME
touch  start_count.txt
touch  /tmp/list_recent.txt


#------------------------------------------
#------------------------------------------
When you decide to finally save your session this can be run after five minutes or two hours or whenever you want to save the work you did
you can continue working there is no need to shut down the computer to get the save file (this is very flexible ) I could write a GUI for this with options to save different folders with or without browser saves etc... but all that can be fine tuned by looking at the skeleton of what this script is doing and adjusting it to your needs

Code: Select all

#!/bin/bash

# a way to make a "Porteus module"  of recent changes
# user defined from a start time reference point
# until the user decides to stop recording
# so this is a unique between two time points save file
# Joe Arose bigbass   tested on slackware 14 with mksquashfs installed

#==========================================

# This gets run when you want to see from when the reference point was set
# until now what happened you can run this part many times

# clean up
rm -r /tmp/recent_work
mkdir -p /tmp/recent_work

find -newer  start_count.txt |tee  /tmp/list_recent.txt
#----- unfilterd --------------------
cat  /tmp/list_recent.txt


# shave off the first two characters  this helps copying the files
sed -i 's/^..//g' /tmp/list_recent.txt

# if the file has just a dot on the first line remove it so it doesnt copy all files
sed -i '1 d' /tmp/list_recent.txt

# we dont want to copy the trash bin this may be different I am using KDE
sed -i '/\.local\/share\/Trash/d' /tmp/list_recent.txt


# we dont want to copy .local/share
sed -i '/\.local\/share/d' /tmp/list_recent.txt


# we dont want to copy .kde/share
sed -i '/\.kde\/share/d' /tmp/list_recent.txt


# we dont want to copy .gvfs
sed -i '/\.gvfs/d' /tmp/list_recent.txt


# we dont want to copy .gconf
sed -i '/\.gconf/d' /tmp/list_recent.txt


# we dont want to copy .dbus
sed -i '/\.dbus/d' /tmp/list_recent.txt


# we dont want to copy .gnupg
sed -i '/\.gnupg/d' /tmp/list_recent.txt


# we dont want to copy .Xauthority
sed -i '/\.Xauthority/d' /tmp/list_recent.txt


# we dont want to copy .config/geany
sed -i '/\.config\/geany/d' /tmp/list_recent.txt


# we dont want to copy .config/blueman
sed -i '/\.config\/blueman/d' /tmp/list_recent.txt


# we dont want to copy .config/Trolltech.conf
sed -i '/\.config\/Trolltech\.conf/d' /tmp/list_recent.txt


# we dont want to copy .config/akonadi
sed -i '/\.config\/akonadi/d' /tmp/list_recent.txt







#-------filtering done--------------
cat  /tmp/list_recent.txt


while read filename
do
  echo  "$filename"
  cp -a --parents "$filename" /tmp/recent_work
   
   
done < /tmp/list_recent.txt

# all your files were copied into /tmp/recent_work
# some files maybe hidden so change the option to see hidden files
# from here you could make a module with a date stamp

# changed to use mksquashfs I am testing on slackware 14
# create the module in $HOME directory with current date and time


BRAND=`date +"MDY_%m-%d-%y-TIME_%R"|tr ':' '_'`

mksquashfs /tmp/recent_work $HOME/changes-$BRAND.xzm


#=====================================


Reading even one man page in its entirety is an act which can only result in turning one's previously bright, eager and enthusiastic grey matter into an exhausted, dull-brown, lumpy and life-less pudding.
That's really funny and so true :lol:



*The reason I am doing this on slackware 14 is to show that some of the things that are associated with live cd's can be done also on a standard linux install
and if it can be done on a standard linux install and on a live cd without specialized scripts it is more linux friendly and easier to port to any distro without much work
Last edited by bigbass on 23 Oct 2012, 15:42, edited 5 times in total.

don570
Contributor
Contributor
Posts: 99
Joined: 01 Jun 2012, 00:37
Location: Ontario

Re: Find Files in -specific- folders...

Post#7 by don570 » 23 Oct 2012, 00:42

I made a module for pfind 5.04 which allows a search in a specific folder as an option..
http://forum.porteus.org/viewtopic.php? ... 217#p11217

It needs Thunar file manager which is in Porteus XFCE.

A right click on 'Send to' menu item

Image

User avatar
bigbass
Contributor
Contributor
Posts: 151
Joined: 13 Jan 2012, 14:35
Distribution: slackware 14

Re: Find Files in -specific- folders...

Post#8 by bigbass » 24 Oct 2012, 15:43

I am going to make this simple
almost 90% of the searches you need you just want a quick
answer many apps require a long wait to generate a database
and when you need a deep finding tool that's fine but waiting makes me feel desperate


For me most of the time I need a fast search
and uncluttered and that's why I use a simple fast find

just place this in /usr/sbin and make it executable

Code: Select all

#!/bin/bash
# make a simple fast find call this ff and make it executable
find / -maxdepth 3 -name "$@"
now you just open a terminal and type some of these examples
ff leafpad
ff firefox
ff firefox*


you get the idea ff is find fast

now that's easy fast and no command line confusion
and the output is uncluttered and no man pages required

Joe

tb01
White ninja
White ninja
Posts: 12
Joined: 23 Aug 2012, 16:42
Distribution: P-MATE (all) x32/x64, debian
Location: -happydale-

Re: Find Files in -specific- folders...

Post#9 by tb01 » 29 Apr 2014, 18:06

Wow! These responses are impressive! Thank you so -very- much, to each of you!!!

I must apologize for giving the impression of abandoning my 'call for help'. I'm certain I got notified via Yahoo! Mail of responses, but considering hundreds of spam msgs hitting each day, I've not engaged additional 'fracturing of my mind' for some time now.

Though I visit often to search for ideas, helps, fixes, etc, I've apparently not been logging into my Porteus Forum account, either! Had to reset my password - which meant Yahoo! Mail - my mind (again) broken...

Still, I wish to apologize for my frustrated experiences with learning Linux. I completely understand why things move and change so fast, and completely appreciate how and why this is a -very good- thing. Having spent a good amount of my professional life creating & editing technical documentation, I also appreciate why docs are rarely completely 'up-to-date' with how things are. In my prior corporate life, I would slow the release of patches to allow documentation to appear simultaneously; but that was a uniquely cumbersome and slow-progressing vertical industry. I would dislike seeing Linux (Porteus in particular!) held-up or slowed in any way.

I had full comprehension of all this before I started learning Linux. I've now managed to learn enough to become truly dangerous, and occasionally, have managed to un-hose a few of my prior 'dangers'. Some times, I even (think I) understand what I broke, and how I later fixed it -- the real fun being that when revisiting such events, the situation has evolved to an entirely new scenario and all the details have changed.

Still, with all these frustrations, the Linux world is SOOOOOooooo very much a vast improvement over what I lived with nearly 28 years in the M$ world. FOSS is the -only- sensible, logical and (it seems) functional approach to (my personal) experience of having a computer at all. If it can't be made to do what I want in the way that I want it to do things, well, what -IS- the point?

Every time WinUpdate would reset my IE settings (constant), my settings to Auto-update (or not!), or WinFirewall settings (used ZoneAlarm or Commodo), I realized M$ must be intentionally opening back-doors to _everyone's_ *perceived* level of security -- for some nefarious motivation. Thank you Edward Snowden for bravely validating what I always suspected!

So, I hope I've not ruffled any feathers. I do apologize for getting so frustrated with the process, despite understanding why. Rest assured, I have -NOT- abandoned Porteus, nor Linux as a whole. In fact, I've been actively working to convert many 'point-and-click' types over to Porteus, with -some- actual success! Of course, these are folk who would never venture into a terminal session, but...

Again, thank you so VERY much to everyone who posted responses to my request for help. I haven't the time currently to absorb each post, but a quick scan clearly shows the support I haven't easily found in other distros. And for this, I am -truly- grateful!!!!!!!! (grin)

--tb01

.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Find Files in -specific- folders...

Post#10 by Rava » 02 Oct 2022, 05:26

I really like bigbass two-part solution. Especially since using an empty time stamp file not even takes one byte of storage space.

Since bigbass was not here in years, it's an approx 0% chance he would answer, I still hope someone else might still be able to answer my below question about /tmp/list_recent.txt .

Though I would change his

Code: Select all

#!/bin/bash
[…]
cd $HOME
touch  start_count.txt
touch  /tmp/list_recent.txt
into just this

Code: Select all

#!/bin/bash
touch  ~/start_count.txt
since the cd $HOME is obsolete when you can refer to the user's $HOME directory by simply using ~/

Also, I do not see the need in creating /tmp/list_recent.txt at this point.

Does anyone see why he created /tmp/list_recent.txt with the 1st script and I am just slow on the uptake on that?
Cheers!
Yours Rava

bour59
Samurai
Samurai
Posts: 181
Joined: 29 Dec 2010, 08:10
Distribution: porteus v5.0-xfce K5.19.7
Location: France

Find Files in -specific- folders...

Post#11 by bour59 » 02 Oct 2022, 09:35

@bigbass about FastFind

Code: Select all

#!/bin/bash
# make a simple fast find call this ff and make it executable
find / -maxdepth 3 -name "$@"
why not use an alias

Code: Select all

alias ff='find / -maxdepth 3 -name '

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Find Files in -specific- folders...

Post#12 by Rava » 02 Oct 2022, 10:26

bour59 wrote:
02 Oct 2022, 09:35
why not use an alias
Good idea. :good:

But users might use that as guest as well and that would create a list of unreadable files / folders.

Code: Select all

guest@porteus:~$ alias ff='find / -maxdepth 3 -name ' 
guest@porteus:~$ ff palemoon
find: ‘/.cache’: Permission denied
find: ‘/root’: Permission denied
find: ‘/tmp/pulse-PKdhtXMmr18n’: Permission denied
find: ‘/tmp/xdg-runtime-root’: Permission denied
/usr/bin/palemoon
find: ‘/run/udisks2’: Permission denied
/opt/palemoon
/opt/palemoon/palemoon
My suggestion - omit all error messages:

Code: Select all

guest@porteus:~$ alias ff='find / -maxdepth 3 -name 2>/dev/null '
guest@porteus:~$ ff palemoon
/usr/bin/palemoon
/opt/palemoon
/opt/palemoon/palemoon
Cheers!
Yours Rava

Post Reply