Python file Lookup

Source: Internet
Author: User

#!/usr/bin/python import os import string def get_name(path_name, file_str):          dir_name = []          dir_name = os.listdir(path_name)          for i in range ( 0 , len (dir_name)):                  curdir = os.path.join(path_name, dir_name[i])                  if os.path.isdir(curdir):                          if file_str in dir_name[i]:                                  print ‘DIR:‘ + curdir                          get_name(curdir, file_str)                  else :                          if file_str in dir_name[i]:                                  print ‘FILE:‘ + curdir file_name = raw_input ( "Input file name:" ) path = raw_input ( "Input path:" ) get_name(path, file_name)

Python file Lookup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.