I'm currently trying to move and rename a batch of files. The following for
loop moves the .jpeg files into each subject's folder (subjects.txt
is just a text file containing a column of IDs):
for i in `awk '{print $1}' data/subjects.txt`; do find data/ -name ${i}*_img.jpeg | xargs -I file cp file data/${i}/ ; done
However, renaming each file to "img.jpeg" hasn't worked so far:
for i in `awk '{print $1}' data/subjects.txt`; do find data/ -name ${i}*_img.jpeg | xargs -I file cp file data/${i}/img.jpeg ; done
Please let me know if you have any suggestions!
I would like to achieve the following:
data/subject_1/img.jpeg
data/subject_2/img.jpeg
data/subject_3/img.jpeg
question from:
https://stackoverflow.com/questions/65875838/linux-move-a-batch-of-files-and-rename 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…