How can I copy all the images in the second column of a CSV file and put them to a new folder named images? It has about 300k images so I wonder if there is a fast way to this (like I have 12 processors):
[jalal@goku cleaned_affenet_manually_annotated]$ head -5 modified_training_for_FER2013.csv
,subDirectory_filePath,expression
0,689/737db2483489148d783ef278f43f486c0a97e140fc4b6b61b84363ca.jpg,3
1,392/c4db2f9b7e4b422d14b6e038f0cdc3ecee239b55326e9181ee4520f9.jpg,6
2,468/21772b68dc8c2a11678c8739eca33adb6ccc658600e4da2224080603.jpg,6
3,944/06e9ae8d3b240eb68fa60534783eacafce2def60a86042f9b7d59544.jpg,3
[jalal@goku cleaned_affenet_manually_annotated]$ wc -l modified_training_for_FER2013.csv
283903 modified_training_for_FER2013.csv
csvkit(you can install it usingsudo apt-get install python3-csvkit. It comes with several command-line utilities likecsvcut,csvgrepetc. You could then use something likecsvcut -c 2 ./test.csv | tail +2 | xargs cp -t /tmp. – wvxvw Dec 5 '17 at 8:53