Just a short test on my side, i hope the comments explain what i have done.
I'm assuming bash.
Basically googling for "bash read csv file" did the job for me.
The rest is really just some if else logic and basic commands.
OLDIFS=$IFS # store old delimiter for csv files
IFS=" | " # set delimiter of csv file
# attempt to get the filename of the only csv file in the current folder
# doesn't work if there are multiple csv files -> look into fuzzy finder or demenu for example
# doesn't work if csv file doesn't exist in current directory
# of course you can read the filename from command line with read command
# ls | grep *.csv might be useful to get all names of csv files in current directory
filename=$(ls | grep *.csv) # store output of command pipe in filename
echo "$filename" # debug, to see what is stored in $filename
while read f1 f2 f3 # read csv file, each line, 3 fields per line
# debug, echo each field
echo "field 1 is: $f1"
echo "field 2 is: $f2"
echo "field 3 is: $f3"
echo "does $f2 exist?"
[ -d $f2 ] && echo "yes" || echo "no" # really just a short if else, in case you don't know this one
if [ ! -d $f2 ]; then # if directory in second column of csv doesn't exist
echo "creating directory"
mkdir -p $f2 # -p creates necessary parent directories if they don't exist
echo "copying $f3 to $f2/$f3"
cp $f3 $f2/$f3 # copying doesn' force you to move files for testing, replace with move
done < $filename
# script never reaches this point if anything before fails
# if you want to use this script more often you should think about a way to reliably reset $IFS
IFS=$OLDIFS # reset delimiter
My csv file:
whatever number | /existing_path/nonexisting_path/move_stuff_here | testfile.txt
testfile.txt has to exist in your current working directory for this to work.
Nonexisting_path is just there to show mkdir -p.