how to copy directory to a tftp server ?

Endorsed Question
Mar 22nd, 2013

Hi all

This may sound basic but can anyone tell me how to copy a directory from my flash to a tftp server ?

cheers

Carl

I have this problem too.
1 vote
Endorsed by Giuseppe Larosa
Steve Fuller about 3 years 4 months ago

Hi,

One way of doing this would be by the use of the archive command with the /create option to make a TAR file that is copied to the TFTP server.

Here's an example where I have a directory (called directory) with a number of files. I create an archive of this directory and send that directly to my TFTP server called redhat1.

<p>ocs7206-2#cd disk0:</p><p>ocs7206-2#dir</p><p>Directory of disk0:/</p><p></p><p>    1  -rw-       15617  Jul 22 2008 17:03:00 +01:00  ocs7206-2-124-13c-config</p><p>    3  -rw-     1161737   Oct 4 2011 14:33:36 +01:00  cpu_mon</p><p>    6  drw-           0  Mar 24 2013 08:11:26 +00:00  directory</p><p></p><p>47890432 bytes total (46645248 bytes free)</p><p>ocs7206-2#dir directory</p><p>Directory of disk0:/directory/</p><p></p><p>    7  -rw-       18899  Mar 24 2013 08:12:42 +00:00  file1.txt</p><p>    8  -rw-       18899  Mar 24 2013 08:12:48 +00:00  file2.txt</p><p>    9  -rw-       18899  Mar 24 2013 08:12:52 +00:00  file3.txt</p><p></p><p>47890432 bytes total (46645248 bytes free)</p><p><span>ocs7206-2#archive tar /create t</span><a class="jive-link-external-small" href="ftp://redhat1/directory.tar">ftp://redhat1/directory.tar</a><span> disk0:/directory</span></p><p>!!</p><p>archiving file1.txt (18899 bytes)</p><p>archiving file2.txt (18899 bytes)</p><p>archiving file3.txt (18899 bytes)</p>

And on my TFTP server I can see the tar file and it's contents:

<p>[[email protected] tftpboot]$ ls -l directory.tar</p><p>-rw-r--r-- 1 sfuller sfuller 58368 2013-03-24 08:21 directory.tar</p><p>[[email protected] tftpboot]$ tar tvf directory.tar</p><p>-rw-r--r-- 0/0           18899 2013-03-24 08:12:42 file1.txt</p><p>-rw-r--r-- 0/0           18899 2013-03-24 08:12:48 file2.txt</p><p>-rw-r--r-- 0/0           18899 2013-03-24 08:12:52 file3.txt</p>

Hopefully the above, or some slight variation, will do exactly what you need.

Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4.8 (3 ratings)
mahmoodmkl Fri, 03/22/2013 - 02:46

Hi
I m not u can copy a dirctory but u can copy a file from flash line below
Copy flash:filename tftp
After this u will be primpted for tftp ip address

Sent from Cisco Technical Support iPhone App

Hitendra Suthar Thu, 10/30/2014 - 14:09

You can copy TAR IOS file to TFTP. 

You can use tftpd32 v3.3 and set some parameters so file can be copied .

tftpd32 - > Settings -> TFTP Configurations
timeout (seconds) - 1200
Max Transmite - 100000


Fire command on Switch (privileged EXEC mode)
Switch(2960-X)#
Switch(2960-X)#archive upload-sw tftp://tftp -server-ipaddress/ios file name

Switch(2960-X)#archive upload-sw tftp://172.20.100.100/c2960x-universalk9-mz.150-2.EX5


Thanks
Hitendra Suthar

Steve Fuller Sun, 03/24/2013 - 01:34

Hi,

One way of doing this would be by the use of the archive command with the /create option to make a TAR file that is copied to the TFTP server.

Here's an example where I have a directory (called directory) with a number of files. I create an archive of this directory and send that directly to my TFTP server called redhat1.

<p>ocs7206-2#cd disk0:</p><p>ocs7206-2#dir</p><p>Directory of disk0:/</p><p></p><p>    1  -rw-       15617  Jul 22 2008 17:03:00 +01:00  ocs7206-2-124-13c-config</p><p>    3  -rw-     1161737   Oct 4 2011 14:33:36 +01:00  cpu_mon</p><p>    6  drw-           0  Mar 24 2013 08:11:26 +00:00  directory</p><p></p><p>47890432 bytes total (46645248 bytes free)</p><p>ocs7206-2#dir directory</p><p>Directory of disk0:/directory/</p><p></p><p>    7  -rw-       18899  Mar 24 2013 08:12:42 +00:00  file1.txt</p><p>    8  -rw-       18899  Mar 24 2013 08:12:48 +00:00  file2.txt</p><p>    9  -rw-       18899  Mar 24 2013 08:12:52 +00:00  file3.txt</p><p></p><p>47890432 bytes total (46645248 bytes free)</p><p><span>ocs7206-2#archive tar /create t</span><a class="jive-link-external-small" href="ftp://redhat1/directory.tar">ftp://redhat1/directory.tar</a><span> disk0:/directory</span></p><p>!!</p><p>archiving file1.txt (18899 bytes)</p><p>archiving file2.txt (18899 bytes)</p><p>archiving file3.txt (18899 bytes)</p>

And on my TFTP server I can see the tar file and it's contents:

<p>[[email protected] tftpboot]$ ls -l directory.tar</p><p>-rw-r--r-- 1 sfuller sfuller 58368 2013-03-24 08:21 directory.tar</p><p>[[email protected] tftpboot]$ tar tvf directory.tar</p><p>-rw-r--r-- 0/0           18899 2013-03-24 08:12:42 file1.txt</p><p>-rw-r--r-- 0/0           18899 2013-03-24 08:12:48 file2.txt</p><p>-rw-r--r-- 0/0           18899 2013-03-24 08:12:52 file3.txt</p>

Hopefully the above, or some slight variation, will do exactly what you need.

Regards

Actions

This Discussion