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.
0 votes
Endorsed by Giuseppe Larosa
steve-fuller about 2 years 1 month 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.

ocs7206-2#cd disk0:

ocs7206-2#dir

Directory of disk0:/

    1  -rw-       15617  Jul 22 2008 17:03:00 +01:00  ocs7206-2-124-13c-config

    3  -rw-     1161737   Oct 4 2011 14:33:36 +01:00  cpu_mon

    6  drw-           0  Mar 24 2013 08:11:26 +00:00  directory

47890432 bytes total (46645248 bytes free)

ocs7206-2#dir directory

Directory of disk0:/directory/

    7  -rw-       18899  Mar 24 2013 08:12:42 +00:00  file1.txt

    8  -rw-       18899  Mar 24 2013 08:12:48 +00:00  file2.txt

    9  -rw-       18899  Mar 24 2013 08:12:52 +00:00  file3.txt

47890432 bytes total (46645248 bytes free)

ocs7206-2#archive tar /create tftp://redhat1/directory.tar disk0:/directory

!!

archiving file1.txt (18899 bytes)

archiving file2.txt (18899 bytes)

archiving file3.txt (18899 bytes)

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

[sfuller@redhat1 tftpboot]$ ls -l directory.tar

-rw-r--r-- 1 sfuller sfuller 58368 2013-03-24 08:21 directory.tar

[sfuller@redhat1 tftpboot]$ tar tvf directory.tar

-rw-r--r-- 0/0           18899 2013-03-24 08:12:42 file1.txt

-rw-r--r-- 0/0           18899 2013-03-24 08:12:48 file2.txt

-rw-r--r-- 0/0           18899 2013-03-24 08:12:52 file3.txt

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

Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4.5 (2 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.

ocs7206-2#cd disk0:

ocs7206-2#dir

Directory of disk0:/

    1  -rw-       15617  Jul 22 2008 17:03:00 +01:00  ocs7206-2-124-13c-config

    3  -rw-     1161737   Oct 4 2011 14:33:36 +01:00  cpu_mon

    6  drw-           0  Mar 24 2013 08:11:26 +00:00  directory

47890432 bytes total (46645248 bytes free)

ocs7206-2#dir directory

Directory of disk0:/directory/

    7  -rw-       18899  Mar 24 2013 08:12:42 +00:00  file1.txt

    8  -rw-       18899  Mar 24 2013 08:12:48 +00:00  file2.txt

    9  -rw-       18899  Mar 24 2013 08:12:52 +00:00  file3.txt

47890432 bytes total (46645248 bytes free)

ocs7206-2#archive tar /create tftp://redhat1/directory.tar disk0:/directory

!!

archiving file1.txt (18899 bytes)

archiving file2.txt (18899 bytes)

archiving file3.txt (18899 bytes)

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

[sfuller@redhat1 tftpboot]$ ls -l directory.tar

-rw-r--r-- 1 sfuller sfuller 58368 2013-03-24 08:21 directory.tar

[sfuller@redhat1 tftpboot]$ tar tvf directory.tar

-rw-r--r-- 0/0           18899 2013-03-24 08:12:42 file1.txt

-rw-r--r-- 0/0           18899 2013-03-24 08:12:48 file2.txt

-rw-r--r-- 0/0           18899 2013-03-24 08:12:52 file3.txt

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

Regards

Actions

Login or Register to take actions

This Discussion

Posted March 22, 2013 at 2:16 AM
Stats:
Replies:3 Overall Rating:4.5
Views:7558 Votes:0
Shares:0
Tags: No tags.