Python Forum
Matching Duplicate file names with different extentions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matching Duplicate file names with different extentions
#3
glob.glob(pattern) will return a list of file names matching that pattern. You can use it to check for each of this file but with .txt extension. If it exists - os.path.exists('test99.txt') for example.
If that happens use os.mkdir() to create a directory with a proper name and move the files there - os.rename().
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: Matching Duplicate file names with different extentions - by wavic - Aug-07-2017, 11:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Matching string from a file tester_V 5 514 Mar-05-2024, 05:46 AM
Last Post: Danishhafeez
  rename same file names in different directories elnk 0 736 Nov-04-2022, 05:23 PM
Last Post: elnk
  Saving Excel workbook file with dataframe names Biplab1985 0 2,053 Jun-07-2020, 12:25 PM
Last Post: Biplab1985
  Finding Duplicate in CSV file bond009 3 2,417 May-14-2020, 05:37 AM
Last Post: bond009
  Details of attachment files in a msg file such as file names save into a python list klllmmm 2 5,764 Nov-12-2019, 05:59 AM
Last Post: klllmmm
  splitstring file names a by hyphen steve22020 3 3,322 Oct-30-2019, 05:39 PM
Last Post: steve22020
  Is there a more effecient way to do this ? File Names sumncguy 2 2,114 Jul-11-2019, 12:47 PM
Last Post: DeaD_EyE
  How to combine file names into a list from multiple directories? python_newbie09 3 5,261 Jul-09-2019, 07:38 PM
Last Post: python_newbie09
  Duplicate output when calling a custom function from the same file? road2knowledge 2 2,434 May-10-2019, 07:58 AM
Last Post: road2knowledge
  write each line of a text file into separate text files and save with different names Shameendra 3 2,825 Feb-20-2019, 09:07 AM
Last Post: buran

Forum Jump:

User Panel Messages

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