![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Excluding directories with find | x96riley3 | UNIX for Dummies Questions & Answers | 3 | 04-08-2009 04:12 AM |
| "find command" to find the files in the current directories but not in the "subdir" | swamymns | Shell Programming and Scripting | 9 | 07-22-2008 11:23 AM |
| to find a file in set of directories | jazz | High Level Programming | 3 | 11-16-2005 09:36 AM |
| Find directories not containing foo, and copy foo to them | dkaplowitz | Shell Programming and Scripting | 6 | 06-29-2005 08:50 AM |
| Find wildcard .shtml files in wildcard directories and removing them- How's it done? | Neko | UNIX for Dummies Questions & Answers | 1 | 06-27-2001 09:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Find files in Directories
Hello,
We have in a file a list of the path of files from one server. We want to search if these files exist on another server , but the path on this new server isn't the same. We want to use the command "awk" but there isn't the god way. Example: on server 1 in a file : listServer1.txt we have /toto/titi/file.txt /toto/titi/exam.txt On server 2 we want to search on /bbb/gggg/file.txt /bbb/gggg/exam.txt Can someone help us with this little problem Thanks... |
|
|||||
|
Quote:
find / -name "file.txt" -type f -exec ls -l {} \; Looking at your input file, s script such as the following should get you started.... Code:
#!/bin/ksh
while read line; do
filename=${line##*/}
wcho "Finding filename: ${filename}"
find . -name "${filename}" -type f -exec ls -l {} \; 2>/dev/null
done < filelist
exit 0
ZB |
|
|||||
|
looking for all the files in the list will confirm that you have the right directory but ... if there's one file in your list that you know does not exist anywhere else --- just find the directory that file resides in and you're there already ...
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|