How to determine if there's a file in directory!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to determine if there's a file in directory!
# 1  
Old 11-02-2011
How to determine if there's a file in directory!

Hi All,

I'm just wondering how can i determined if there's a file in directory and put it in a logs?
Code:
dir="/home/test/"

Please advise,
Thanks,

Moderator's Comments:
Mod Comment Use code tags, thanks.

Last edited by zaxxon; 11-02-2011 at 03:23 AM.. Reason: code change; zaxxon: code tags
# 2  
Old 11-02-2011
Code:
ls $dir > log

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Determine BL and RL of a file

A regular ebcdic mainframe tape usually contains header information the 1st three blocks of the tape. The header information tells the computer/user more information about what is on tape. The header info is 240 bytes in length at 80 bytes each header. The 1st block/header is volume name or... (1 Reply)
Discussion started by: Linux-wannabe
1 Replies

2. Shell Programming and Scripting

[Perl] Determine directory name

Hi there, I wonder if it is possible the determine a name of a directory which is different on various hosts. Let me try to explain. I have the directory /tmp/dir1/dir2/canchangedir. This directory name is different on various hosts. I need to use the directory name, independent from the... (2 Replies)
Discussion started by: ejdv
2 Replies

3. UNIX for Advanced & Expert Users

How to determine if a file is done copying

I have a file repository in a directory where files are copied into it by ftp or samba. Some of the ftp transfers can be slow, and some of the files can be fairly large. The files are not being used for anything in this directory other than being taken out of the directory and used by the... (2 Replies)
Discussion started by: husker_ricky
2 Replies

4. Shell Programming and Scripting

determine owner of a file

Hello, I am on a mission to determine the user of file. I have used the ls -l command but it displays permission, link, user, group, etc, but I just want to display just the name of user of a specified file. Many thanks (4 Replies)
Discussion started by: unibboy
4 Replies

5. UNIX for Advanced & Expert Users

How Can I Easily Determine If A File Has been Added to a Directory

I am uploading files that need to be processed prior to uploading. I will put the files in a directory. My question is how can I write an easy process to kick off a script once a file has been added? Is there an easy way to determine if a file has been added to a directory? Thanks (7 Replies)
Discussion started by: goodmis
7 Replies

6. UNIX for Dummies Questions & Answers

How Can I Easily Determine If A File Has been Added to a Directory

I am uploading files that need to be processed prior to uploading. I will put the files in a directory. My question is how can I write an easy process to kick off a script once a file has been added? Is there an easy way to determine if a file has been added to a directory? Thanks (1 Reply)
Discussion started by: goodmis
1 Replies

7. UNIX for Advanced & Expert Users

cannot determine current directory

Hi, when I execute some simple commands on my solaris system, I am getting the following warning message: Could anybody tell me what could be the reason Ex:- If I give the command, which ls Warning: cannot determine current directory ... (15 Replies)
Discussion started by: axes
15 Replies

8. Shell Programming and Scripting

determine owner directory permissions from within the directory

From within a directory, how do I determine whether I have write permission for it. test -w pwd ; echo ? This doesn't work as it returns false, even though I have write permission. (4 Replies)
Discussion started by: Sniper Pixie
4 Replies

9. UNIX for Dummies Questions & Answers

determine the size of a file???

Hello, Can someone please tell me which command to use to determine the size of a file? When I log in to my shell account, I do this $>% ls -als total 632 8 -rw-r--r-- 1 user01 devgrp1 1558 Jul 30 23:25 .kshrc What is "1158"? Bytes? Kilobytes? I apologize if my... (8 Replies)
Discussion started by: alan
8 Replies

10. UNIX for Dummies Questions & Answers

How to determine if a file is ASCII?

I'm writing a script that takes a filename as an argument, which determines the "file type" of the file. I want to know if there is any command I can use to determine if a file is ASCII type, thanks all for giving a help. (11 Replies)
Discussion started by: popo
11 Replies
Login or Register to Ask a Question