Jupyter running bash (Not DOS) on windows

Hello!

First of all, thanks for your effort in teach us about DL! I’m really excited about this course and I’m trying to follow your request to do everything from my own and only after that copying it(If necessary).
So, I’m having issues using the bash command ‘!’ on jupyter, because I’m using windows on my own machine.

My Configuration:
windows 10
cygwin 64
jupyter
python 2.7 - NOT using anaconda

Problem:
When I do commands using the ‘!’ on front of the command, it’s using the DOS(Command Prompt of windows) and not the bash from the cygwin.
So, for example, this command doesn’t work:
!mkdir train/cats
However, this does work:
!mkdir train\cats (The slash is inverted in windows and therefore, works)

Everything related to python works (so all the code showed in the videos worked), but I’m trying to do myself the separation of the files in cats and dogs folder using this command:
!mv $(ls train/dog*.jpg) train/dogs
And if I use bash in a command line, works, but inside jupyter no.

I already tried to run the jupyter notebook command inside of a bash instance, but still have no success.

PS: I only have one Kernel being showed in the jupyter and it’s the ‘Python 2’

Any other suggestions?

Thanks,
Joao Sauer

I believe the convention in windows uses the \ which is a bit of a pain because bash can interpret it as an escape character.

I used the os.rename() function to move the files and that worked great for me. It uses the ‘/’ convention, but it’s a bit of a workaround.

Thanks for the reply!

Yeah, Using some python functions it would be possible, but I was wondering if anyone had this problem before, because appears to be something so simple to be fixed.
:slight_smile:

One solution that I found is to run the bash command, but then, for each cell, you need to run it. For example, this works:
%%bash . ~/.bashrc mkdir train/cats mkdir train/dogs

However, you need to add the first two lines for each cell. :frowning: