I want to get the latest files from multiple directories, d1, d2,d3 and d4 under the parent dierectoy d.
can anyone help out with this?
thx
I want to get the latest files from multiple directories, d1, d2,d3 and d4 under the parent dierectoy d.
can anyone help out with this?
thx
cd /some_place/d
find d1 d2 d3 d4 -type f | xargs -I{} cp {} .
What do you mean by "latest"?
the file with the newest date
With the benefit of hindsight, that was a silly question
cd /some_place/d
for I in d1 d2 d3 d4; do
cp $I/$(ls -t $I | head -1) .
done