I am writing a script that reads all of the files of a certain type in a given directory, and I'm wondering if there is a way to allow the directory location to be a user input.
Currently the code looks like:
directory_in = dir('C:\Folder\Bob\*.dat');
I would like to change it to something more like:
input_in = input('Enter the directory name: ');
directory_in = dir(input_in, '*.dat');
I know this code won't work as written for multiple reasons, but I'm wondering if there is some way I could combine the user input with the file type suffix in order to minimize the amount of editing a future user would need to perform on the script.
Best Answer