I'm trying to move media and other files which are in a specified directory to another directory, which will be created if it does not exist. And, I'm trying to create a directory where the remaining files with different extensions will go. My first problem is that my script is not making a new directory and it is not moving the files to other directories. How can I move files with different extensions to one directory?
This is what i have had so far. Please correct me where I'm wrong and help modify my script:
#!/bin/bash
From=/home/katy/doc
To=/home/katy/mo #directory where the media files will go
WA=/home/katy/do # directory where the other files will go
if [ ! -d "$To" ]; then
mkdir -p "$To"
fi
cd $From
find . -type f -name"*.mp4" -exec mv {} $To \;
