Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to tftp a bunch of files

tftp -m binary 192.168.1.2 -c put file1 target/file1

I've been trying to use cmd line expansion such as

tftp -m binary 192.168.1.2 -c put `ls *` target/`ls *`

but this doesn't seem to work, a ":" gets inserted after target.

Is there a quick way to expand this kind of stuff?

I want to reuse the values I got in the first expansion into the next expansion

share|improve this question

1 Answer 1

up vote 4 down vote accepted

First of all, `ls *` is wrong. The same intended result can be achieved by using just *, as in:

tftp -m binary 192.168.1.2 -c put * target/

Wildcard expansions are processed by your shell before running the command, so the correct way to expand * to a list of files is to simply use *, never `ls`.


Second, the tftp put command can upload multiple files, but it only accepts a single destination directory when doing so. You don't need to specify multiple targets, and it would not work anyway – tftp wouldn't know where source files end and target files begin. (As said earlier, the wildcards are expanded by your shell, so tftp would receive put file1 file2 file3, not put *.)


The mysterious : is caused by ls listing the contents of subdirectories. When you run ls *, the shell actually runs ls file1 file2 dir1 (let's assume you have two files and a directory). Then ls prints "file1", "file2", followed by "dir1: (...all files in dir1...)".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.