Off topic:How to move the folders to a new directory based on their match in the csv file?
0
0
Entering edit mode
6.1 years ago
Vasu ▴ 770

Hi,

Don't know whether I can ask this question here or not. Need some help.

There are folders like "F1", "F2", "F3","F4", "F5" in the current directory "SD". In the current directory there is a csv file mentioning the folder names like below.

csv file:

id
F1
F4
F3

I want to move the folders to a new directory based on their matching in the csv file.

Lets say new directory is "POT". For eg:

We see that folder names F1, F4, F3 are matching with the csv file. So, I want to move those folders into POT directory.

I tried this way but it didn't work:

xargs -a <(tail -n +2 file.csv) -I{} sh -c '[ -d "{}" ] && mv -t POT "{}"'

Any help is appreciated. Thank you

linux mac command • 626 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2007 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6