Created
December 27, 2021 08:14
-
-
Save e96031413/c1096702d45c85de0130a2772cebfe27 to your computer and use it in GitHub Desktop.
Copy file to a specific folder with paths in a txt file
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 | |
fileListingFile = "missclassified_file_path.txt" | |
outputDir = "./" | |
# sample path in txt: /root/notebooks/XXXXX/datasets/XXXXXXXX.jpg | |
with open(fileListingFile, "r") as file: | |
fileNames = [file.strip() for file in file.readlines()] | |
for file in fileNames: | |
shutil.copy(file, os.path.join(outputDir, file.split("/")[-1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment