Skip to main content
added 345 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose names ends with .json in the single directory, you may want to consider rsync (which has better facilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

A third option would be to create a tar archive of the remote directory, or at least the files that you'd want to transfer, and then scp that archive over to the local system. In fact, that could be done in one go with ssh, simulating scp -r:

ssh username@remote 'tar -c -f - -C /remote_path .' | tar -x -f - -C /local_path

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose names ends with .json in the single directory, you may want to consider rsync (which has better facilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose names ends with .json in the single directory, you may want to consider rsync (which has better facilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

A third option would be to create a tar archive of the remote directory, or at least the files that you'd want to transfer, and then scp that archive over to the local system. In fact, that could be done in one go with ssh, simulating scp -r:

ssh username@remote 'tar -c -f - -C /remote_path .' | tar -x -f - -C /local_path
added 1 character in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose namenames ends with .json in the single directory, you may want to consider rsync (which has better abilitiesfacilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose name ends with .json in the single directory, you may want to consider rsync (which has better abilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose names ends with .json in the single directory, you may want to consider rsync (which has better facilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

added 129 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose name ends with .json in the single directory, you may want to consider rsync (which has better abilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose name ends with .json in the single directory, you may want to consider rsync (which has better abilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

Consider transferring the whole directory instead of individual files:

scp -r username@remote:/remote_path /local_path/

If that would transfer too much and you really only want to transfer the files whose name ends with .json in the single directory, you may want to consider rsync (which has better abilities for filtering what gets transferred):

rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/

This would only copy files whose names end in .json but ignore other names. The terminating / on the source is needed here.

The -a option makes the transfer also transfer file meta data (timestamps, basically) and makes rsync recurse down into subdirectories (but this is restricted by --exclude above), while -v is for verbose operation.

Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading