0
SRCDIR="source/directory"
TMPDIR="temp/directory"
[ ! -d "$TMPDIR" ] && mkdir -p "$TMPDIR"
for file in `find "$SRCDIR" -ctime -1 -type f -name "abc*pdf*"`; do
    cp $file $TMPDIR
done
cd $TMPDIR
ext=`echo $file1|awk -F. '{if (NF>1) {print $NF}}'`
if [ $ext == "Z" ]; then
uncompress $file1
fi
done

I want to transfer file from Unix to Windows which are in $TMPDIR. But I don't know how to connect Unix to Windows in the script.

I am using psftp to transfer files from Unix to Windows manually. I want to automate this process using script.Can I use psftp in script or can it be done using batch script? Could someone help me how can I connect Unix to Windows.

  • 1
    Why don't you make a share on Windows, mount it then copy the files to it? Alternatively you could use smbclient. – Cristian Ciupitu Aug 8 '14 at 15:39
  • You can use cygwin64 and password-less ssh as well. – peterh Aug 8 '14 at 16:09
  • You can have a batch script which runs something like: psftp someLoginName@someIP -pw somePassword -b "get /some/place/on/the/unix/box" – frank.s Aug 8 '14 at 16:42
  • Do you want to run that transfer script on the Windows machine or on the Unix machine? How is the script that you show related to the file transfer script that you want to write? – Gilles Aug 9 '14 at 19:58
  • @ Gilles The script I want to written in Unix, but i do not know how to connect unix and windows. – Aravind Aug 11 '14 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.