I have some files in a recursive folder structure, which I would like to copy to destination and give them a uuid name instead of the original name (because the names collide).
Nonrmally I would do something like this:
SOURCE_DIR="/some/*/dir/struct/*/img_files" &&\
DEST_DIR="/dest/folder/0" &&\
rm -rf $DEST_DIR &&\
mkdir -p $DEST_DIR &&\
find $SOURCE_DIR \( -name "*.jpg" \) -exec cp {} $DEST_DIR \;
but because the names collide, I am unable to do this. Thus, I would like to assign a uuid name to each file which is being copied. To this end, I have tried this:
SOURCE_DIR="/some/*/dir/struct/*/img_files" &&\
DEST_DIR="/dest/folder/0" &&\
rm -rf $DEST_DIR &&\
mkdir -p $DEST_DIR &&\
find $SOURCE_DIR \( -name "*.jpg" \) -exec cp {} $DEST_DIR/"$(uuidgen).jpg" \;
but I get only copied file :( rather than a bunch of files in the folders.