Copy name of folder/subfolder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smegghead
    New Member
    • Dec 2009
    • 3

    Copy name of folder/subfolder

    i'm new to this scripting lark and

    i need to be able to copy the name of a folder/subfolder into a path statement so i can then use that path to extract data from a specific file in that folder

    if anyone could help i'd be grateful

    thx
    Last edited by bvdet; Dec 2 '09, 05:00 PM. Reason: Assign a more appropriate title
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Your question is unclear. In the future, please use a more appropriate title. See posting guidelines.

    If you assign a folder/subfolder name to an identifier, you can can use that in a path with string formatting. Example:
    Code:
    >>> name = "my_folder/my_subfolder"
    >>> path = "C:/root_folder/%s/" % (name)
    >>> path
    'C:/root_folder/my_folder/my_subfolder/'
    >>>

    Comment

    • smegghead
      New Member
      • Dec 2009
      • 3

      #3
      apologies was in a rush when sent post

      many thanks for response, will try when back at work tomorrow

      Comment

      Working...