05-27-2007
#!/bin/sh
ls -lR / | awk -v filename="$1"
'/\//{ dir=$0}
/^-/{ if ( $9 == filename ) {
print "Found : " filename " in " dir
}
}'
I think its the same as u had posted.
Let me know if here is some syntax mistake
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
given a start directory,a filename,how to find it? (3 Replies)
Discussion started by: bluo
3 Replies
2. Shell Programming and Scripting
Hello,
I create a file touch 1201093003 fichcomp
and inside a repertory (which hava a lot of files) I want to list all files created before this file :
find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long
but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
Can somebody tell me which command will help me find whether the OS is 32 bit or 64 bit.
Regards,
Giridhara Babu Tadikonda. (3 Replies)
Discussion started by: giribt
3 Replies
4. Shell Programming and Scripting
I need to write a script to find files older than 2 hours in set of direcotries and list them ina mail. I know find command ti list files greater/lesser than days but i need to do it for hours. Any input. (6 Replies)
Discussion started by: Presanna
6 Replies
5. Shell Programming and Scripting
I need to find all sticky bit dir/files on my system and clean them up if necessary.
How to I write a script to do this?
Thanks. (2 Replies)
Discussion started by: pdtak
2 Replies
6. Shell Programming and Scripting
Dear friends,
please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories..
it is like this,
current directory contains
file1, file2, file3, dir1, dir2
and dir1 conatins
file4, file5
and dir2 contains
file6,... (9 Replies)
Discussion started by: swamymns
9 Replies
7. UNIX for Dummies Questions & Answers
I'm writing a script that will search for files with the SUID bit turned on, and put the list in a file called id.txt
i read that files with the SUID bit turned on are chmod'd to 4000, so i tried:
find / -perm 4000 > id.txt
also various others such as -perm 4777 etc etc
but it found nothing... (1 Reply)
Discussion started by: SoVi3t
1 Replies
8. Shell Programming and Scripting
what is the find to command to find the files created last 30 days (5 Replies)
Discussion started by: rajkumar_g
5 Replies
9. Shell Programming and Scripting
Hi, Can somebody tell me which command will help me find whether the OS is 32 bit or 64 bit. OS is LInux
Thanks (3 Replies)
Discussion started by: aish11
3 Replies
10. Shell Programming and Scripting
I need to find a word '% Retail by State' in the folder /usr/sas/reports/RetailSalesTaxallocation.
When I tried like below,
-bash-4.1$ cd /usr/sas/reports/RetailSalesTaxallocation
-bash-4.1$ find ./ -name % Retail by State
find: paths must precede expression: Retail
Usage: find ... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies
TEMPNAM(3) 1 TEMPNAM(3)
tempnam - Create file with unique file name
SYNOPSIS
string tempnam (string $dir, string $prefix)
DESCRIPTION
Creates a file with a unique filename, with access permission set to 0600, in the specified directory. If the directory does not exist or
is not writable, tempnam(3) may generate a file in the system's temporary directory, and return the full path to that file, including its
name.
PARAMETERS
o $dir
- The directory where the temporary filename will be created.
o $prefix
- The prefix of the generated temporary filename.
Note
Windows uses only the first three characters of prefix.
RETURN VALUES
Returns the new temporary filename (with path), or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 4.0.3 | |
| | |
| | This function's behavior changed in 4.0.3. The |
| | temporary file is also created to avoid a race |
| | condition where the file might appear in the |
| | filesystem between the time the string was gener- |
| | ated and before the script gets around to creat- |
| | ing the file. Note, that you need to remove the |
| | file in case you need it no more, it is not done |
| | automatically. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
tempnam(3) example
<?php
$tmpfname = tempnam("/tmp", "FOO");
$handle = fopen($tmpfname, "w");
fwrite($handle, "writing to tempfile");
fclose($handle);
// do here something
unlink($tmpfname);
?>
NOTES
Note
If PHP cannot create a file in the specified $dir parameter, it falls back on the system default. On NTFS this also happens if the
specified $dir contains more than 65534 files.
SEE ALSO
tmpfile(3), sys_get_temp_dir(3), unlink(3).
PHP Documentation Group TEMPNAM(3)