Find: cannot access <file name>


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find: cannot access <file name>
# 1  
Old 05-08-2013
Find: cannot access <file name>

Hi,

I am getting below error in the log file:

<<
01/05/13 23:30:02 Script Start
find: cannot access tu
File name :
01/05/13 23:30:03 no input file found
01/05/13 23:30:03 Script End
>>

Below is the part of shell script which runs once in a week.It tries to find the latest file created in last 5 minutes with name "xyz.prn".If found then it does some processing.

<<

#!/bin/sh
{
mydir=/home/prn/
touch /home/prn/tu
chmod 777 /home/prn/tu

perl -e '$t=time-600; utime $t,$t,"tu"'

i=`find $mydir -xdev -type f -name "xyz.prn" -newer tu -exec ls {} \;;`

echo 'File name : ' $i

if [ -f "$i" ] then
echo " File found : " $i
# does some processing
else
log "no input file found"
fi

log "Script End"
} >> /home/prn/a.sh 2>&1


>>

Kinldy help me to dentify the issue.How can this warning/error avoided?

Thanks in advance
# 2  
Old 05-08-2013
If you want to find file created in last 5 minutes use -mtime in find and what is tu? is it some file if yes it it accessable by user you running the script?
# 3  
Old 05-08-2013
Specify the full path for the file like you did when you created it with touch:
Code:
i=`find $mydir -xdev -type f -name "xyz.prn" -newer /home/prn/tu -exec ls {} \;;`

Edit: The perl part may not be working correctly for the same reason.
# 4  
Old 05-08-2013
doubt

Thanks Cero for your reply. I have one doubt that $mydir already contains the path where both files [xyz.prn and tu ] are located.

i=`find $mydir -xdev -type f -name "xyz.prn" -newer tu -exec ls {} \;;`

I may be wrong, i just wanted to bring into your notice this point.

Kindly suggest.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find command with Ignore Access issues

Hi, I am using following command to find a specific file. find . -name "find*.txt" -type f -print I am issuing that command at root directory since I don't know in which sub folder that file is getting created from some other process. As I am not having access to all directories, my... (3 Replies)
Discussion started by: RameshCh
3 Replies

2. UNIX for Advanced & Expert Users

Where to find accounts with su access?

Hi, This is for some system audit - there are sulog files that recorded all su activities, we need to verify that all the user accounts in the log are supposed to have su capability. Is there some configuration file where all the user accounts with su access are listed? (similar to /etc/sudoers... (3 Replies)
Discussion started by: seafan
3 Replies

3. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

4. AIX

Want to find the last access time for large group of files at one go

Dear All, I'm working as a DBA and dont have much knowledge at OS level commands.we have requirement that we need find the files which has been last accessed >= apr 2010and also access date <= apr 2010 for a large set of files.Do know some commands likeistat, ls -u.But can anyone provide me the... (4 Replies)
Discussion started by: dbanrb
4 Replies

5. Shell Programming and Scripting

Find file with exact access date

Hi I have to write command that find the files/dirs in the directory with access date equal to timestamp. ie or to be more precise I need to find files which are not equal to given timestamp drwxr-xr-x 2 oracle oinstall 4096 May 31 2007 tmp so need to have something like find . *... (2 Replies)
Discussion started by: zam
2 Replies

6. Programming

how to write Microsoft Access MDB file to a text file, using C ?

I'm in the UNIX environment. I'd like to read a Microsoft Access MDB file, and write the contents of that file into an ASCII text file. I want to write a C program to do this. Does anyone know if there's already source code out there that does this? Please advise. Thanks. (3 Replies)
Discussion started by: serendipity1276
3 Replies

7. SCO

Find access times

I am working on a SCO Unixware 7.1.4 server and I have been asked to determine over the last year when a file was accessed, not just the last time it was accessed. Is there anyway to figure this out? Thanks in advance, Kevin Harnden (1 Reply)
Discussion started by: chefsride
1 Replies

8. AIX

Find all users with shell access

Hi, how do I find all users currently setup with shell access. Thanks in advance. Gav (1 Reply)
Discussion started by: LionFeen
1 Replies

9. Shell Programming and Scripting

find . but not access subdirectories

Hello, I'm trying to figure out how to prevent this find command from accessing this diretories's subdirectories! I tried the maxdepth and prune but they don't seem to work on SUN. So now i'm trying to set up a nawk command to not process any files that have "REVISED" in there name: find... (3 Replies)
Discussion started by: bobk544
3 Replies

10. UNIX for Advanced & Expert Users

find files with a perticular year of access

Hello all, Might be a silly question, on my AIX machine the year had changed to 2022 and some files were accessed on this date hence the time stamp on these files is with year 2022, there are many such files. i want to list all these file from the root dir and subdir with 2022 year... (3 Replies)
Discussion started by: pradeepmacha
3 Replies
Login or Register to Ask a Question