StreetView360X / get_filenames.py
everettshen's picture
Upload 14 files
d7b4a46 verified
raw
history blame contribute delete
709 Bytes
# read filenames and return a .txt (do locally instead of on colab)
import os
# Replace 'your_folder_path_here' with the path to your directory
folder_path = 'combined'
file_names = []
# List all files in the directory and append them to the file_names list
for filename in os.listdir(folder_path):
if os.path.isfile(os.path.join(folder_path, filename)):
file_names.append(filename)
# Specify the name of the text file where the filenames will be written
output_file_path = 'file_names.txt'
# Write the filenames to the specified text file
with open(output_file_path, 'w') as file:
for name in file_names:
file.write(f"{name}\n")
print(f"Filenames written to {output_file_path}")