Python Forum
How to search full path of specified file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to search full path of specified file
#2
Why not use the user-friendly pathlib module from the standard library ?
from pathlib import Path

file1_name = Path("D:") / "Backupdata"
post_fix = Path() / "PythonCodes" / "InputCSV1.csv"

if (file1_name / post_fix).isfile():
    print("File exists")
else:
    print("No such file")
Reply


Messages In This Thread
RE: How to search full path of specified file - by Gribouillis - Dec-14-2019, 03:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Search Excel File with a list of values huzzug 4 1,312 Nov-03-2023, 05:35 PM
Last Post: huzzug
  Search for multiple unknown 3 (2) Byte combinations in a file. lastyle 7 1,444 Aug-14-2023, 02:28 AM
Last Post: deanhystad
  File path by adding various variables Mishal0488 2 1,089 Apr-28-2023, 07:17 PM
Last Post: deanhystad
  search file by regex SamLiu 1 947 Feb-23-2023, 01:19 PM
Last Post: deanhystad
  Script File Failure-Path Error? jerryf 13 3,558 Nov-30-2022, 09:58 AM
Last Post: jerryf
  If function is false search next file mattbatt84 2 1,181 Sep-04-2022, 01:56 PM
Last Post: deanhystad
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,244 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  fuzzywuzzy search string in text file marfer 9 4,685 Aug-03-2021, 02:41 AM
Last Post: deanhystad
  Cloning a directory and using a .CSV file as a reference to search and replace bg25lam 2 2,172 May-31-2021, 07:00 AM
Last Post: bowlofred
  Subprocess.Popen() not working when reading file path from csv file herwin 13 15,304 May-07-2021, 03:26 PM
Last Post: herwin

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020