Last active
March 12, 2021 08:31
-
-
Save imhemish/66ada7e6972b8ce44f04e10a7fd0157f to your computer and use it in GitHub Desktop.
fileListing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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