title: CENTOS - Bash script to initiate a file transfer from a directory
body: <p>I am trying to create a bash script to initiate a file transfer to another machine via tftp app. currently i would do this manually by running the command <code>./tftp &quot;filename&quot; tftp://ipaddress/filename.</code></p>
  <p>What i would like to do is have a bash script that looks at a folder e.g (filetransfer) for any files an initiates that same command. can someone please help? as i am a noob at bash scripting</p>
  <p>so far i have tried the below</p>
  <p>when running this is says that the filename is bad</p>
  <pre><code>#!/bin/bash
  for filename in ./*
  do
    ./tftp &quot;$filename&quot; tftp://ipaddress/&quot;$filename&quot;
  done
  </code></pre>
  <p>also tried this</p>
  <p>when running this one below it transfers everything on the directory below it.</p>
  <pre><code>#!/bin/bash
  cd /path/to/the/directory/*
  for i in *
  do
    ./tftp &quot;$i&quot; tftp://ipaddress/&quot;$i&quot;
  done
  </code></pre>