[RndTbl] script for file copy

Trevor Cordes trevor at tecnopolis.ca
Wed Jul 7 14:53:31 CDT 2010


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 = ".")


More information about the Roundtable mailing list