Permalink
Browse files

Updated the ls command.

  • Loading branch information...
1 parent 8a4e287 commit 47f6c5b1bc3c45aef954aa22ef7036dfebb4deae @shanesatterfield committed Jun 7, 2012
Showing with 14 additions and 3 deletions.
  1. +14 −3 production/app/lib/ftpsession.py
View
17 production/app/lib/ftpsession.py
@@ -42,8 +42,20 @@ def quit(self):
self.ftp.quit()
# Shows the files in the directory.
- def ls(self):
- pass
+ def ls(self, path=''):
+ list = []
+ if path:
+ list = self.ftp.nlst(path)
+ else:
+ list = self.ftp.nlst()
+
+ b = 0
+ for x in list:
+ if "." in x:
+ print x
+ b+=1
+ if b==0:
+ print 'None.'
# Shows the directories in the directories.
def dir(self):
@@ -74,7 +86,6 @@ def file_exists(self, filename):
def dir_exists(self, dirName):
pass
-
# Forced close from the ftp session.
def close(self):
self.ftp.close()

0 comments on commit 47f6c5b

Please sign in to comment.