Sorry if this has an answer elsewhere, I've no idea how to search for my problem.
I was running some simulations on a redhat linux HPC server, and my code for handling the folder structure to save the output had an unfortunate bug. My matlab code to create the folder was:
folder = [sp.saveLocation, 'run_', sp.run_number, '/'];
sp.run_number was an integer. I forgot to convert it to a string, but for some reason running
mkdir(folder); (in matlab) still succeeded. In fact, the simulations ran without a hitch, and the data got saved to the matching directory.
Now, when the folder structure is queried/printed I get the following situations:
- When I try to tab autocomplete:
run_ run_^A/ run_^B/ run_^C/ run_^D/ run_^E/ run_^F/ run_^G/ run_^H/ run_^I/
- When I use
run_ run_? run_? run_? run_? run_? run_? run_? run_? run_? run_?.
- When I transfer to my mac using rsync the
run_\#003/etc. with (I assume) the number matching the integer in
sp.run_numberpadded to three digits, so the 10th run is
- When I view the folders in finder I see
run_ run_ run_ run_ run_ run_ run_ run_ run_ run_?
- Looking at this question and using the command
ls | LC_ALL=C sed -n lI get:
run_$ run_\001$ run_\002$ run_\003$ run_\004$ run_\005$ run_\006$ run_\a$ run_\b$ run_\t$ run_$
I can't manage to
cd into the folders using any of these representations.
I have thousands of these folders, so I'll need to fix this with a script. Which of these options is the correct representation of the folder? How can I programmatically refer to these folders so I rename them with a properly formatted name using a bash script? And I guess for the sake of curiosity, how in the hell did this happen in the first place?