Sponsored Content
Full Discussion: New to linux
Top Forums UNIX for Dummies Questions & Answers New to linux Post 302527440 by michnmi on Friday 3rd of June 2011 09:53:37 AM
Old 06-03-2011
OK then , I've created this directory tree:
3 folders, named images01,images02,images03

They contain files with names like pokemon.jpg,racing.jpg,roses.jpg
One of the filenames is ,for example pokemon01-a.jpg

this is a list of where the files are located

Code:
michnmi@OpenSolaris:~/Documents/Scripts/Unix.comForum/findtest$ ls -lR
.:
total 5
drwxr-xr-x 2 michnmi staff 6 2011-06-03 16:39 images01
drwxr-xr-x 2 michnmi staff 6 2011-06-03 16:41 images02
drwxr-xr-x 2 michnmi staff 5 2011-06-03 16:41 images03

./images01:
total 2
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:38 pokemon01-a.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:39 racing001-a.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:38 roses012-b.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:38 roses015-c.jpg

./images02:
total 2
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:41 pokemon121-kl.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:39 racing011-b.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:39 racing08-fe.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:40 roses234-ak.jpg

./images03:
total 2
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:39 racing058-cd.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:39 racing118-ce.jpg
-rw-r--r-- 1 michnmi staff 0 2011-06-03 16:41 roses114-ee.jpg
michnmi@OpenSolaris:~/Documents/Scripts/Unix.comForum/findtest$

Now imagine , for your case that my 'findtest' directory is your 'images' folder.

This folder, has three sub folders (images01,images02,images03). I believe from the list I've given above, it is fairly obvious where each file is located.

Now from the 'prompt' , I'll change into my images folder (mine is called,as i've said 'findtest', using the cd command. Then I'll execute the find command. I'll play with grep as well to see if the output that is returned makes it easier for you.

So, scenario is I'm in my home folder and I'm begining....

Code:
michnmi@OpenSolaris:~$ 
michnmi@OpenSolaris:~$ cd Documents/Scripts/Unix.comForum/findtest/
michnmi@OpenSolaris:~/Documents/Scripts/Unix.comForum/findtest$ find . | grep pokemon
./images01/pokemon01-a.jpg
./images02/pokemon121-kl.jpg
michnmi@OpenSolaris:~/Documents/Scripts/Unix.comForum/findtest$

This means that from where I am (/export/home/michnmi/Documents/Scripts/Unix.comForum/findtest) the 'relative' location of the files that contain the word pokemon in their filename is this one:
Code:
./images01/pokemon01-a.jpg
./images02/pokemon121-kl.jpg

pokemon01-a.jpg is under folder 'images01' which is a subfolder of the folder we are in at the moment we ran the
Code:
find .

command (the '.' is important) and pokemon121-kl.jpg is under images02 folder which is...etc

So, how are we now?

MM
 

2 More Discussions You Might Find Interesting

1. Fedora

Which is the better platform to learn UNIX/Linux (Kali Linux Vs. Red Hat or other)?

I just started a new semester and I started my UNIX class yesterday. I've already decided to use python along with my learning process but what I really want to use with it is Kali as my UNIX/Linux platform to learn off of since I already wanted to learn Cyber Sec. anyways. I just wanted to know if... (12 Replies)
Discussion started by: ApacheOmega
12 Replies

2. UNIX for Beginners Questions & Answers

Simple sed command not working; could be a Mac/Linux vs. PC/Linux issue

Hello, I am on a Mac and trying to clean up some monthly files with a very simple SED: sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt (from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file) then output to output.txt Even when I try... (2 Replies)
Discussion started by: verbatim
2 Replies
All times are GMT -4. The time now is 02:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy