Quote:
Originally Posted by
lkeswar
Hi,
Actually i got a client requirment and i need experts help here.
we have 30 parent directories and in that we have so many subdirectories and files. i want to find only latest timestamp files with out touching subdirectories
and need to redirect the latest files into some other directory as /tmp/usr.
please help me in advance.
This makes no sense to me. You can't look at files in a directory (parent directory or subdirectory) without "touching" (i.e., reading) the directory contaiing the files you want to search.
Are you saying that the files you want to look at all files in the 30 parent directories and you don't want to search any subdirectories in any of those parent directories? Something else???
What do you mean by
redirect a file into some other directory? Move it? Copy it? Hard link it? (Are the source and target directories in the same filesystem?) Soft link it? Something else???
How are the parent directories named? Are they all on a single filesystem?
If the names are only distinct down to a one second resolution, how do you know that two files won't be created in different directories in the same second (so that
redirecting them into a common target directory won't overwrite one of them?
What do you mean by the latest files? The last
x files created in all of the file hierarchies rooted in your 30 parent directories? All of the files created in the 30 parent directories that have been created since the last time you ran this script? Something else???
Is
ps.queueapprocessor.output.log. present in all of the files you want to process with only the appended date/time stamp changing? Or, do other parts of the name also vary from directory to directory???