File search in the directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File search in the directory
# 1  
Old 02-23-2010
File search in the directory

Hi! All,

I am new here...

Hello to all!!!!!!!!

I want to know how to know files present in the directory.
i do not want direcory name in the directory?
# 2  
Old 02-23-2010
actually you want to know all the files under the directory.... Am I correct?
# 3  
Old 02-23-2010
Quote:
Originally Posted by kaushelsh168
Hi! All,

I am new here...

Hello to all!!!!!!!!

I want to know how to know files present in the directory.
i do not want direcory name in the directory?
Hello and welcome!

It seems that you're also new to Unix/Linux.

I should read one of the Basic UNIX Tutorials here:

https://www.unix.com/answers-frequent...tutorials.html

Regards
# 4  
Old 02-23-2010
MySQL Search only files

If you want only the files in the current directory use the following,

Code:
find . -maxdepth 1 -type f

If you want the files recursively use

Code:
find . -type f

Thanks.
# 5  
Old 02-23-2010
Using ls -l | grep "^-" .

This can be used to list only the files under the directory.
In the ls -l's output if it begins with - character then it will be a file. If it begins with d then it will
be a directory.

Last edited by thillai_selvan; 02-23-2010 at 06:43 AM..
# 6  
Old 02-23-2010
Hi,

Sorry for late..

Yes you are right, i need file present in a directory

---------- Post updated at 04:50 PM ---------- Previous update was at 04:44 PM ----------

Thanks to you all... for reply

Last edited by kaushelsh168; 02-23-2010 at 07:15 AM.. Reason: spell
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Search directory for string and print file name

Good Evening Folks - I have a need to search a specific directory and ALL sub-directories for the following string: Data Load UpdatedIf this string is found, I need to print content from the line directory above it between symbols, as well as the file name where it is found. Here is a... (1 Reply)
Discussion started by: SIMMS7400
1 Replies

2. Shell Programming and Scripting

Script to search every file in a directory and print last few lines

Hi everyone, I need to write a script to search a directory, output the name of a file to an ouput file and print the last few lines of the files to the output file such that I would have something like this: FILE1: LINE LINE LINE FILE2: LINE LINE LINE FILE3: LINE LINE LINE... (2 Replies)
Discussion started by: mojoman
2 Replies

3. Shell Programming and Scripting

Search for a file in all directories and place the file in that directory

Hi All, Daily I am getting the updated file. I have to search for this file in all directories and sub directories. If the file existed in a particular directory then move this updated file to that particular directory. If the file is not existed in any of the directories then place this... (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies

4. UNIX for Dummies Questions & Answers

How to search for a file having a particular character in a particular place in a directory.?

Hi Guys, I want to search for a specific file in a directory which have a "b" letter as the 3rd character in the name of the file. For Example : /abc/efg/ldbjfblkj.sh /abc/efg/erublkd.sh /abc/efg/eibueora.sh /abc/efg/kfvnmnb.sh Since we have 2 files with "b" as a 3rd character in... (5 Replies)
Discussion started by: Pramod_009
5 Replies

5. Shell Programming and Scripting

Change to directory and search some file in that directory in single command

I am trying to do the following task : export ENV=aaa export ENV_PATH=$(cd /apps | ls | grep $ENV) However, it's not working. What's the way to change to directory and search some file in that directory in single command Please help. (2 Replies)
Discussion started by: saurau
2 Replies

6. UNIX for Dummies Questions & Answers

How to search directory for specific file?

I am new to Unix scripting and would like some help. Here is my scenario: 1) I have a text files that contains two fields: file name and retention period in months: File1 36 file2 24 File3 12 2) The directory I am searching contains sequential files. 3) I need to be able to take the file name... (10 Replies)
Discussion started by: Mustafa19804
10 Replies

7. Shell Programming and Scripting

How to search/replace a directory path in a file using perl

Hello All, Here is what I am trying to do and maybe you guys can point me in the right direction. I have a file that contains the following string(s): WARNING: </d1/test/program1> did not find item1 WARNING: </d1/test/program1> item1 does not exist WARNING: </d1/test/program2> item1 failed... (1 Reply)
Discussion started by: maxshop
1 Replies

8. Shell Programming and Scripting

Search for a file in specific directory

I have to search a file in a prticular directory. filename will be passed through command line. The directory may contain subdirectory. i.e. suppose directory in /u03/appl (it can hard coded in script). This directory may contain subdirectory. $ scriptname.sh filename output should be... (2 Replies)
Discussion started by: jadoo_c2
2 Replies

9. UNIX for Dummies Questions & Answers

Linux shortcutkey to search specific file from a list of directory?!

Hi, I'm the new user of linux/unix. Can I ask that anybody know how to use the linux/unix shortcut key to search a specific file from a list of directory? For example, I know the file name that I want to search. But I forget which directory or location is my desired file put.Got any shortcut... (7 Replies)
Discussion started by: patrick87
7 Replies

10. Shell Programming and Scripting

shell script to search content of file with timestamps in the directory

hello, i want to make a script to search the file contents in my home directory by a given date and output me the line that has the date... (10 Replies)
Discussion started by: psychobeauty
10 Replies
Login or Register to Ask a Question