Skip to content

Instantly share code, notes, and snippets.

@imhemish
Last active March 12, 2021 08:31
Show Gist options
  • Save imhemish/66ada7e6972b8ce44f04e10a7fd0157f to your computer and use it in GitHub Desktop.
Save imhemish/66ada7e6972b8ce44f04e10a7fd0157f to your computer and use it in GitHub Desktop.
fileListing
import os
import shutil
listing = os.listdir()
filtered = []
for item in listing:
if ".mp3" in item:
tempdata = item.split(".mp3") # Can use any other file than .mp3
requireditem = tempdata[0]
filtered.append(requireditem)
with open("current.txt", "w") as file:
for i in filtered:
file.write(i + "\n")
shutil.copy("current.txt", "..\\Shared") # This is just for me as I wanted to copy the file somewhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment