1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Rep Power

    SFTP using paramiko

    Hey, i am using sftp to collect files from other server using paramiko. But the problem is that i have to get certain specific types of files . So i am using mask in my xml. But i don't know which function to use get the files . How to use listdir or any other function to get specific files matching the xml.
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Rep Power
    >>> import os, re, glob
    >>> files = os.listdir(os.curdir)
    >>> select_files = [f for f in files if re.search('expression',f)]
    >>> # or
    >>> files = glob.glob('*.txt')
    I hope one of these concepts helps. Looks like you'd need to combine with xml reader.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo