os.path.islink()

Egor Bolonev ebolonev at mail.ru
Wed Dec 8 10:18:25 CET 2004


hi all

i want my program to ignore ntfs links, but os.path.islink() isnt work as  
i expect

print os.path.islink('''C:\Documents and Settings\Егор\My  
Documents\Scripts\Antiloop\'''')
outputs
False

far file manager said 'C:\Documents and Settings\Егор\My  
Documents\Scripts\Antiloop\' is link

how to detect ntfs links?

=program======
import os, os.path

def get_all_files(path):
     if len(path) > 0:
         if path[-1] == ':':
             path=path+'\\'
     try:
         for i in os.listdir(path):
             j = os.path.join(path, i)
             if os.path.isdir(j) and not os.path.islink(j):
                 for ii in get_all_files(j):
                     yield ii
             else:
                 yield j
     except:pass

for i in get_all_files('c:'):
     print i
==============



More information about the Python-list mailing list