when I run the component parts at the command line it works fine. Any ideas?
When I run the script I get a permission denied with the path of the file I am trying to move. I am running this as root. root owns the directory I am moving to.
****************************
#!/bin/bash
export homedir='/home/sftp'
echo $homedir
ls $homedir | grep foo >/tmp/foo
while read -r line
do
if $homedir/$line$homedir/$line/*; then mv `find $homedir/$line$homedir/$line -type f -print | egrep -v '^dev|etc|lib|libexec|out|proc|selinux|tmp|usr|vari|bin|.ssh'` $homedir/$line ; echo $line `ls $homedir/$line` >>/var/log/mvftp.log; else echo $line'no files to move' >>/tmp/ftpmv.out; fi
done
When I run the script I get a permission denied with the path of the file I am trying to move. I am running this as root. root owns the directory I am moving to.
****************************
#!/bin/bash
export homedir='/home/sftp'
echo $homedir
ls $homedir | grep foo >/tmp/foo
while read -r line
do
if $homedir/$line$homedir/$line/*; then mv `find $homedir/$line$homedir/$line -type f -print | egrep -v '^dev|etc|lib|libexec|out|proc|selinux|tmp|usr|vari|bin|.ssh'` $homedir/$line ; echo $line `ls $homedir/$line` >>/var/log/mvftp.log; else echo $line'no files to move' >>/tmp/ftpmv.out; fi
done