ERROR:root:Line magic function `%mv` not found

I recently installed Anaconda so Jupyter notebook is up-to-date and all (I think).
BUT despite that, it seems like the magic function %mv is missing. Indeed, if I type %lsmagic in my notebook, the %mv is missing from the list I obtain.

Any idea how to install it?

I could of course move the files from Cygwin, but I think it’s better for later to have everything working in a single notebook…

%mv isn’t actually a magic - there’s some config that lets you use % instead of ! in certain cases. A bit of googling didn’t find what that config is, and I can’t recall the details - so unless you manage to find it, or someone else here tells us what it is, you’ll need to use !mv instead of %mv for now.

1 Like

I faced the same issue.

!mv dog*.jpg dogs/ works fine

I just started this course…apologies I found out about this late.

In case there are those who are like me who can’t get %mv working at all, here’s another solution and its using shutil.move.

import glob, os, shutil

files = glob.iglob(os.path.join("%YOUR_PATH%\sample\train\", “cat.*.jpg”))
for file in files:
if os.path.isfile(file):
shutil.move(file, “%YOUR_PATH%\sample\train\cats\”)

1 Like

In Windows 10, you can use !move, e.g.
!move dog*.jpg dogs/

This worked for me. :slight_smile:

Thanks to my friend Mitchell for suggesting it.

1 Like


Thank you, Liz!