Index

Subject : Re: LUG: seeking elegant solution

From : Alex Ray <alexjray.ncsu@gmail.[redacted]>

Date : Wed, 16 Nov 2011 20:01:48 -0500

Parent


Checkout bash for loops. I suspect you want something of the form :

for file in $(ls 2/);
do
cp 1/file 2/file
done

Cheers,
Alex

On Nov 16, 2011 7:57 PM, "Aaron Oakes" < ajoakes@ncsu.[redacted] > wrote:
I have what I think should be a pretty easy problem to solve.

In directory 1 are files 1,2,3,4,5.
Directory 2 contains files 2 and 4.

All the files are jpeg images and the files in directory 2 have been
modified more recently than those in directory 1.  I want to copy
files 2 and 4 from directory 1 to directory 2.

Based on my limited past experience with linux I have a hunch that
there is a very elegant and efficient way to accomplish this task.

Any thoughts?

Thanks in advance.

Cheers,
Aaron


Replies :