Quote:
Originally Posted by
bbbngowc
I just put the period there after I finished typing. Blame my English teacher
As for the loop, I'm not looking for directories, I'm looking for files in the directory that are newer than the newer.txt file. It's not working.
Thanks for the reply. Any other suggestions?
An English teacher should know better than to punctuate a shell script.
It makes the script fail. If that's not a problem in your original script, then you didn't get off as easily as I had hoped. As I said, the script works fine here.
As for "finding directories" I tried to say in a non-technical way (perhaps a bad thing in a technical forum) that "find" (at least in Solaris) takes multiple directories as arguments, and that you can find the files in all of the directories at once without resorting to a loop to "find" each directory separately.
Hence, "find all of the directories at once" is more explicitly
"run find using all of the directories as arguments at once".
find dir1 dir2 dir3 -type f -whatever
Perhaps that will get you past whatever the problem is that is giving you the wrong answer.
I do see why the phrasing was perhaps not the best.
You said "this only reads from folder1 and not the other folders" .
Are you sure that it does not [attempt to] read the other folders, or is it that it just does not find the files that you think it should? (there is a difference)
It could be that you have a directory read permission problem that
prevents it from finding the files in the other directories.
What do you get if you do not qualify the search, and just use -print ?
You should see all of the filenames in all of the folders.
Or qualify the search but use -print instead of -exec as the final predicate.
You should see exactly the files you want to have copied.
If so, then you have an entirely different kind of problem.
You also might want to quadruple-check that the timestamps on the files are such that they compare the way you want them to against /tmp2/newer.txt
If you have a tool like Solaris truss or dtrace, use it to see whether the directories are actually being read and the filenames seen, and/or the error codes from the system calls which fail as find attempts to do your bidding.