mv xrags and cp

Ulf Rompe Ulf.Rompe at icem.com
Fri Jan 19 16:27:52 UTC 2007


Am Freitag, den 19.01.2007, 15:14 +0300 schrieb OOzy Pal:
> > > for word in `find olddir -name '*.jpg'
> > > do
> > > ... copy command
> > > done
> >
> > This will fail if there are filenames containing whitespaces.
> >
> Thank you, no whitespaces. But what if there is? Is there a solution.

No, that's an unsolvable problem. :-)

Just kidding, sorry. Of course there are solutions like this:

find olddir -name '*.jpg' | while read oldfile; do
	cp "$oldfile" newdir/$(date +%s%N.jpg)
done

Another one would be to use "find -print0" together with "xargs -0", and
one more incorporating "find -exec" has been posted by Florian Diesch.


[x] ulf 

-- 
STRESSED spelled backwards is DESSERTS.





More information about the ubuntu-users mailing list