I have the following piece of code to pull the names of all files within a particular folder (including all files in it's subfolders):
import sys,os
root = "C:\Users\myName\Box Sync\Projects\Project_Name"
path = os.path.join(root, "Project_Name")
for path, subdirs, files in os.walk(root):
for name in files:
print os.path.join(path, name)
Unfortunately, it throws the following error:
> File "<ipython-input-7-2fff411deea4>", line 8
> print os.path.join(path, name)
> ^ SyntaxError: invalid syntax
I'm trying to execute the script in Jupyter Notebook. I also tried saving it as a .py file and running it through Anaconda prompt but received the same error. Can someone please point out where I'm going wrong? I'm pretty new to Python.
Thanks