I have a directly full of images and I am trying to put together a script/command that will randomly copy (with some probability) the image to a location with a random name at that destination (because I might just want to copy it in place and not collide with the existing file). Also complicating matters is that the file has spaces in it and I have 30 gb of files I am working with
Here is what I have so far. Those file spaces are a killer
#!/bin/bash
for i in $(find pics/ -type f); do
v=$(($RANDOM % 2))
if [ $v -eq 0 ]; then
cp $i dups/$RANDOM.jpg;
fi
done
I would eventually like something like:
./rcp.sh source/ destination/
I have looked at
shuff
but it doesn't get me past my space-in-file name issues either. Maybe there is a way to take this and have it also do the shuffle?