joseph.h.garvin <joseph.h.gar...@gmail.com> added the comment:

Sorry I wasn't terribly clear explaining the problem with mkdtemp. Say you 
create your temporary folder, /tmp/foo. Now you have a regular folder bar laid 
out like so:

bar/
  blarg1.ext
  blarg2.ext
  subdir/
    blarg3.ext
    blarg4.ext

I'd like this to be the result of copying:

/tmp
  /foo
    blarg1.ext
    blarg2.ext
    subdir/
      blarg3.ext
      blarg4.ext

Basically, I'd like to copy bar/ to /tmp/foo such that the paths of the files 
relative to bar/ are the same as the paths of the copied files relative to 
/tmp/foo. AFAICT there's no easy way to do this with copytree's current 
behavior. Because tempfile.mkdtemp() creates /tmp/foo to start, you can't use 
copytree to do this. 

But now I realize copy tree wants to copy the source directory as a directory, 
so you always get /tmp/foo/bar. What I wanted was copy(recursive_glob(src, 
"*"), dst). That would give you the effect you normally get from a utility like 
'cp'.

> It doesn't mean the semantics have to be exactly the same. Actually, many 
> Python users are under Windows where semantics will be different.

I believe 'copy' has the same cp-like semantics I desire under Windows, but 
it's been quite some time since I used it.

So, not a bug, but sticks out to me as missing. Might make sense someday to 
have a keyword arg to copytree that would make it behave this way.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8125>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to