Visit Our UNIX and Linux User Community

Listing files in subdirectory

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Listing files in subdirectory
# 1  
Old 09-04-2011
Listing files in subdirectory

Forgive me if there is an answer to this somewhere in the forums. I've gone through as much as I could but couldn't find a relevant answer.

What I'm trying to do is use the ll command to list some files in a subdirectory that matches a certain format.

I've tried ll *.*a* <subdirectory> but could not get the result that I needed. Instead, it listed the files that matched that format in the current directory then listed all the files in the subdirectory. Something like:

ll *.*a* <subdirectory>
-rw------- 2 <username> 2401 Sep 3 21.51 filename.backup
-rw------- 2 <username> 289 Aug 23 15:53 filename2.bat

total 12
-rw------- 1 <username> 34 Sep 1 21:33 filename3.txt
-rw------- 1 <username> 435 Sep 1 3:34 filename4.bat
-rw------- 1 <username> 455 Aug 7 18:34 filename5.bat

(Sorry about the <subdirectory> and <username>, I have to exclude those two bits of info.)

Am I missing something here? Probably seems like a very simple answer. I'm pretty new to Unix so I'm still trying to pick it up as I go.
# 2  
Old 09-04-2011
ll subdirectory/*.*a*

This User Gave Thanks to shipra_31 For This Post:
# 3  
Old 09-04-2011
ll subdirectory/*.*a*

This User Gave Thanks to yazu For This Post:
# 4  
Old 09-04-2011
I was going to say "hey, I already tried that..." but I just noticed the "/" that I was missing. Thanks! That solved it. Hm, I should go look into that "/" in Unix. Thanks, again!

Previous Thread | Next Thread
Test Your Knowledge in Computers #712
Difficulty: Medium
On a large scale, the ability to treat instructions as data is what makes assemblers, compilers, linkers, loaders, and other automated programming tools possible.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copy non-empty files into subdirectory

How to Copy non-empty files into subdirectory I have directory A there are bunch of files: a.txt b.txt How can i find out the non-empty file within * and copy them into a subdirectory B? Thank you. (2 Replies)
Discussion started by: grace_shen
2 Replies

2. UNIX for Dummies Questions & Answers

How to Find files in subdirectory?

I am trying to find all DAT files in a subdirectory named IN. I do not know the entire path. For example: /stage/<?>/<?>/IN/file.DAT I am using the find command without success: find /stage -name IN -a -name '*.DAT' -print What is the correct logic and syntax? Thank you for the help. (5 Replies)
Discussion started by: TwinGT
5 Replies

3. UNIX for Dummies Questions & Answers

How to move all files in a directory and subdirectory?

I'm trying to organize my MB Pro by moving all my jpeg files to a single folder from the desktop. There are some on the desktop that are not in any folder. I was at the command line and typed mv *.jpg "Jpeg files" but it only moved the files that were on the desktop, not any of the ones that... (3 Replies)
Discussion started by: Straitsfan
3 Replies

4. Solaris

How Prevent from deleting subdirectory files

Hi All, I am using the foolowing find /home/vcrd/put -name '*.z' -mtime +5 -exec rm -f {} \; in a shell script, it is deleting all file having *.z in /home/vcrd/put/appl sub directory. I donot want the files in the subdirectory are deleted. Regards Megh (2 Replies)
Discussion started by: megh
2 Replies

5. Shell Programming and Scripting

How to deleting some files under subdirectory

Hi guys, sorry if my english not very well.. i have a problem.. i have a file and the structure is : Folder/ Folder/ Folder/ Folder/ Folder/ (4 Replies)
Discussion started by: AdziE
4 Replies

6. Shell Programming and Scripting

Count files in every subdirectory

Hi if anyone could help me :) I did a lot of search and 70% of answer is "how to count files in all subdirectories". A basic problem for me is how to count files in every subdirectory separately then sort it by number of files For example: dir1 file1 file2 subdir11 dir2 dir3 ... (3 Replies)
Discussion started by: yorryk
3 Replies

7. UNIX for Dummies Questions & Answers

[Question]How to copy files to all subdirectory

I want to copy php.ini to all subdirectory. what command that should i run? (2 Replies)
Discussion started by: dzufauzan
2 Replies

8. Shell Programming and Scripting

Find files in directory and its subdirectory

I am writing a script which reads a file line by line and then assigns it to a variable like this 1090373422_4028715212.jpg. I have images with file name of this format in some other directory. In my script I want to assign variable with this file name and then find this filename in some other... (11 Replies)
Discussion started by: jyotib
11 Replies

9. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies

10. UNIX for Dummies Questions & Answers

How can I copy files and subdirectory?

I am trying to copy some files from one location to another and I need to write a script to move all the files and the subdirectories to the new location (both unix), but excluding the temp directory. i.e., I want to avoid copying my temp subdirectories during the process of copying other files... (3 Replies)
Discussion started by: odogbolu98
3 Replies

Featured Tech Videos