MIHIR KAR
asked on
How to SFTP multiple file from source to dest in Linux?
Hi Expert,
I have a SFTP job which is failing while transfer file for source to dest using "put" command. As put command only works for single file.
Here my requirement is i want to transfer all the files available in "source/dir1/dir2" and want to merge them into single file then wanna SFTP.
Note:The script should also need to check how many files are there in the source directory before merge them!
thanks in advance.
I have a SFTP job which is failing while transfer file for source to dest using "put" command. As put command only works for single file.
Here my requirement is i want to transfer all the files available in "source/dir1/dir2" and want to merge them into single file then wanna SFTP.
Note:The script should also need to check how many files are there in the source directory before merge them!
thanks in advance.
Use mput rather than put.
Hi,
Your question is not clear,
you want to merge all files into one file then transfer? Why?
Also, below is not clear:
"The script should also need to check how many files are there in the source directory before merge them!"
Your question is not clear,
you want to merge all files into one file then transfer? Why?
Also, below is not clear:
"The script should also need to check how many files are there in the source directory before merge them!"
if sftp is used how about: (sftp uses ssh links underneath, so scp should also work).
scp /from/where/ever/* user@remote_system:/to/dest/
recursive with:
scp -r /from/where/ever/* user@remote_system:/to/dest/
You would tar the files up at the source first, then put it on the destination
tar -czf transferfile.tgz source/dir1/dir2
then you can put transferfile.tgz in the destination.
You probably should be using rsync for this instead, as that will allow you to continue after an interruption. rsync -az source/dir1/dir2 destination/
tar -czf transferfile.tgz source/dir1/dir2
then you can put transferfile.tgz in the destination.
You probably should be using rsync for this instead, as that will allow you to continue after an interruption. rsync -az source/dir1/dir2 destination/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.