Check if certain files exist in a directory, if not add name to a textfile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check if certain files exist in a directory, if not add name to a textfile
# 1  
Old 02-07-2008
Question Check if certain files exist in a directory, if not add name to a textfile

We recieve some logs on our windows box via FTP on a daily basis, in the same directory. I would like to check for missing logs files and add their name to a text file.

Something like...

Check if C:\logs\file1_currentdate exists (if not, add file1_currentdate to C:\missingfiles_currentdate.txt)

Check if C:\logs\file_currentdate exists (if not, add file1_currentdate to C:\missingfiles_currentdate.txt)

Check if C:\logs\file3_currentdate exists (if not, add file1_currentdate to C:\missingfiles_currentdate.txt)


Note: currentdate above is a variable for current date, and missingfiles_currentdate.txt does not exist, so it need to be created first time

It would be great if the above task can be accomplished through a batch file. However other alternatives as welcome as well.

Many Thanks,
SunnyK
# 2  
Old 02-07-2008
"C:\..." ??? Smilie

Which are the *NIX tools you are using on your Windows Box ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Check if 10 files exist

Hi All, Whenever i get 10 files(file names like sales*) then another file need to create. May i know how to implement this in KSH. (4 Replies)
Discussion started by: siddireddy
4 Replies

2. UNIX for Dummies Questions & Answers

Does rsync check and ignore files that already exist?

Hi, We have two (2) servers named primary and standby. There is a directory named /db01/archive that we need to keep in-sync. Files get transferred from primary and standby. Sometimes when we do a failover or when there is a network issue, some files fail to get transferred. I want to use... (3 Replies)
Discussion started by: newbie_01
3 Replies

3. Shell Programming and Scripting

how to check file exist in a directory or not

HI folks, can any one tell me how to check whether the file is existed in a directory or not . let me tell you my requirement : if the file is existed i should display a one message or else i have to send a mail .. i have the mail logic .. but I'm failed to check file existence .. please... (5 Replies)
Discussion started by: sravan008
5 Replies

4. Shell Programming and Scripting

check/wait for files to exist before continuing

I'm attempting to write a pretty simple script. It opens a Filemaker file successfully. That Filemaker file takes around 30-90 seconds to finish. When it's done, it writes a few .xml files into the same directory where my shell script and the Filemaker script reside. In my script, how can I... (2 Replies)
Discussion started by: alternapop
2 Replies

5. Shell Programming and Scripting

check the directory exist

I have the below script to check whether directory is exist or not , now I sure the directory /abc NOT exist , but when run the script , it still pop the result is "the directory exist" , could suggest what is wrong ? thx ll -d /abc > /dev/null 2>&1 if then echo "the directory exist !!" ... (7 Replies)
Discussion started by: ust
7 Replies

6. Shell Programming and Scripting

To check whether a directory is exist and if it is not, create it

Hi, I want to write a shell script to check whether a directory (say A) is existing in a given location and if it is not, create it. (3 Replies)
Discussion started by: sabya
3 Replies

7. Shell Programming and Scripting

How to check directory exist on servers

There are many servers and their directory structer should be exactly the same. To check the directory path for all servers, I wrote a script. #! /bin/ksh ARRAY_DIRECTORIES="/c/dev/custom/bin" ARRAY_DIRECTORIES="/c/dev/db/custom/src" ARRAY_ENV="remoteName200" ARRAY_ENV="remoteName201"... (2 Replies)
Discussion started by: weonpc
2 Replies

8. Shell Programming and Scripting

How to check a file exist and do a copy of other files

Hi, I would like to perform bash which would check the file A.txt to be size 0 or not. If the size is 0, I would copy file B.txt to replace A.txt. Please help. Thanks. -Jason (6 Replies)
Discussion started by: ahjiefreak
6 Replies

9. Programming

how to check if directory/file exist using c/c++

Hi there, how to check if directory/file exist using c/c++ under linux/unix. Thanks. Steven (2 Replies)
Discussion started by: steven88
2 Replies

10. Shell Programming and Scripting

how to check if directory/file exist using c/c++

Hi there,, how to check if directory/file exist using c/c++ under unix/linux? I can use access() under Window MFC. Thanks. Steven (1 Reply)
Discussion started by: steven88
1 Replies
Login or Register to Ask a Question