I'm trying to write a script to move files from one directory to another. The filenames are specified in text files. I keep getting a "Cannot stat foo.jpg: No such file or directory" error on every filename in the list.
Here's the code:
Code:
#!/bin/bash -i
SAVEIFS=$IFS
IFS=$(echo -en "\n")
function gettext () {
echo -e "What text will I be using?"
read -e item
#Allowing for, and correcting, the trailing space in interactive mode
if [[ "$item" =~ " " ]]; then
capfile=${item% *}
else
capfile=$item
fi
#echo $capfile
}
gettext
while IFS=^ read name dest
do
/bin/mv "$name" "$dest"
#echo "File $name is now $newname."
done<$item
IFS=$SAVEIFS
I know this is possible. I had a script that did it correctly, but I lost it re-installing a new Linux disty.
Llewellyn