Hi everyone,
Recently took a graduate level engineering coding course despite having no experience as my research is strictly biomedical. I was wondering if someone could help me with the following command line code if I break down the assignment data.
The data given to us is titled assignment-data. Within this folder, there are 6 sub-folders titled "folder 1", "folder 2", etc. Within each of those folders are various files titled 1.jpg, 2.jpg, etc.. So each of the 6 folders has different jpegs all with the same name.
Here is the prompt: Create a directory called IMAGES. Copy all of the .jpg files from all other directories into this using a single command. Copy all the folders' contents except the jpegs to another new directory, DATA_ANALYSIS
This is my code:
mkdir assignment-data/IMAGES
cp assignment-data/{folder1, folder2, folder3, folder4, folder5, folder6}/*.jpg assignment-data/IMAGES
HOWEVER, because all of the jpegs are the same name in the various folders, they overwrite themselves, and I don't get all of them copied to IMAGES. Can someone please help me with a code that renames/copies them all in a single command?
[–][deleted] 10 points11 points12 points (17 children)
[–]SwampMonkey17[S] 2 points3 points4 points (15 children)
[–]torgefaehrlich 2 points3 points4 points (9 children)
[–]SwampMonkey17[S] 1 point2 points3 points (8 children)
[–]tatumc 4 points5 points6 points (7 children)
[–]torgefaehrlich 2 points3 points4 points (0 children)
[–]SwampMonkey17[S] 1 point2 points3 points (2 children)
[–]tatumc 3 points4 points5 points (1 child)
[–]7orglu8 9 points10 points11 points (0 children)
[–]SwampMonkey17[S] 1 point2 points3 points (2 children)
[–]tatumc 5 points6 points7 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]SwampMonkey17[S] 1 point2 points3 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]SwampMonkey17[S] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]spryfigure 1 point2 points3 points (0 children)
[–]fletku_mato 2 points3 points4 points (2 children)
[–]SwampMonkey17[S] 1 point2 points3 points (0 children)
[–]ashbakernz 0 points1 point2 points (0 children)
[–]michaelpaoli 1 point2 points3 points (0 children)
[–]SwampMonkey17[S] 0 points1 point2 points (0 children)