mardi 17 août 2021

Move a unique file from one directory from another, if it contains a string found in a column of a csv

I have a directory with unique files.

/AF/
1234rem.jpg
5355rem.jpg
3382rem.jpg

I have a csv with

"UID,IP,PORT"

The UID is the first 4 digits of the unique files in /AF/.

I need to create an IF statement that says

IF the UID in one of the files in /AF/ equals a UID in the csv, move that file to a new directory.

This is something that will be ran over and over again as a prior step to running rsync to transfer those files remotely.

I know how to create an IF statement, but how can I compare the first 4 digits of a file name, to an entire column of a csv?

Aucun commentaire:

Enregistrer un commentaire