I want to move a series of file into different folder based on their ID, but I want to make sure that the folder I'm moving the file to exists and is unique
The folders have a matching ID as the first part of their name, but also have a description in their name (the ID should be unique, but I want to guard against that exception) :
0123-app1 4567-app2 2020-app3 0123-shouldntbehere
I want to move file with ID
4567 to the directory
Since the description is in the name, I need to use a wildcard to find the right folder. Right now I tried echoing the name in a variable, but it doesn't help me check if it's unique or if it exists.
What would suggest I use to find the right folder and validate that it's unique ?