[RndTbl] script for file copy
Adam Thompson
athompso at athompso.net
Wed Jul 7 14:57:43 CDT 2010
So?
If SRC=. then the filesnames all become ._whatever. Which is precisely the designed behaviour, in my mind.
Admittedly, that's a classic anti-example of the famous DWIM design principle...
-Adam
-----Original Message-----
From: Trevor Cordes <trevor at tecnopolis.ca>
Sender: roundtable-bounces at muug.mb.ca
Date: Wed, 7 Jul 2010 14:53:31
To: <roundtable at muug.mb.ca>
Reply-To: Continuation of Round Table discussion <roundtable at muug.mb.ca>
Subject: Re: [RndTbl] script for file copy
On 2010-07-07 Adam Thompson wrote:
> Umm... I think I misunderstood the original question. You want to
> flatten a directory structure into a single directory while
> preserving a record of the original path encoded in the filename.
>
> I think this would do what you want:
>
> find "${SRC}" -type f -print | while read F1; do
> F2=$( echo "${F1}" | tr '/' '_' )
> mv "${F1}" "${F2}"
> done
Has the same problem I ran into (before using perl negative
look-behinds) of converting the leading slash to _. (ie if SRC = ".")
_______________________________________________
Roundtable mailing list
Roundtable at muug.mb.ca
http://www.muug.mb.ca/mailman/listinfo/roundtable
More information about the Roundtable
mailing list