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

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    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 Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,900
    Rep Power
    481
    Code:
    >>> 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