trnsmiting thousands ftp files and get an error message

Im transmiting thousands ftp files to a server, when type the command mput *, an error comes and say. args list to long. set to I. So ihave to transmit them in batch or blocks, but its too sloww. what shoul i do?. i need to do a program, or with a simple command i could solve the problem?

"mput *" is expanded in the shell, before it is executed, to "mput file1 file2 file3 ..." There is generally a limit of 32K or so for how long the line can be, which is why you get this error when trying to match * for thousands of files.

I'm not familiar with mput. Is it possible for it to take a list of files instead of arguments on the commandline? You could just do "ls > /tmp/filelist" to make the list.

You can also use xargs to split down that monolilthic list into more manageable batches. Keep the batches large enough and it shouldn't be too much slower. Try this:

# List files in the current directory, piping the output into xargs
ls ./ |
# For each batch of 100 or less, execute "mput file1 file2 ... filen" where filen is the nth file name in the batch.
    xargs --max-args=100 mput

ls will list the files one per line, xargs will group them together in batches of 100 and call 'mput file1 file2 file3 ... file100' for each batch.

Since your "mput'ing" you have access to the source files.
What if you used tar to save all the files to a single tar file and them ftp the single tar file over.....
You could create smaller tar files if the size is to big.

Other options for remote transfer are rcp or scp.

Or nfs mount the file system and copy the files directy.

or do it on the fly with

put "| tar cf - ." filename.tar