On Mon, May 11, 2009 at 4:22 PM, Matt Herzog <m...@blisses.org> wrote:
> Should be simple, right? Not for me, heh.
>
> def schmove(src,dst):
> ...         src = '/home/datasvcs/PIG/cjomeda_exp/'
> ...         dst = '/home/datasvcs/PIG/cjomeda_exp_archive/'
> ...         listOfFiles = os.listdir(src)
> ...         for filez in listOfFiles:
> ...             os.system("mv"+ " " + src + " " + dst)

You aren't using filez at all. Try
  os.system("mv %s/%s %s" % (src, filez, dst))

or you can also use os.path.join() to construct the source path.

> The above code does not copy anything. I sure wish it would spit just one 
> error.
>
> I sure wish I could for the last line go,
>
> shutil.move("src", "dest")

should be
  shutil.move(os.path.join(src, filez), dst)

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to