Python file-io code listing current folder path instead of the specified
- by Tom Brito
I have the code:
import os
import sys
fileList = os.listdir(sys.argv[1])
for file in fileList:
if os.path.isfile(file):
print "File >> " + os.path.abspath(file)
else:
print "Dir >> " + os.path.abspath(file)
Located in my music folder ("/home/tom/Music")
When I call it with:
python test.py "/tmp"
I…