-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathfile_transfer.cheat
More file actions
14 lines (10 loc) · 978 Bytes
/
Copy pathfile_transfer.cheat
File metadata and controls
14 lines (10 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
% File Transfer
$ filename: find "$(pwd)" -type f 2>/dev/null | sort -u
$ local_dir: find "$(pwd)" -type d 2>/dev/null | sort -u
$ remote_dir: printf '%s\n' /tmp
# Copy local file to remote host
nix shell --impure -I nixpkgs=channel:nixos-unstable --expr 'with import (builtins.findFile builtins.nixPath "nixpkgs") { config.allowUnfree = true; }; [ openssh ]' -c scp <filename> your_username@remoteIP:/some/remote/directory
# Copy remote file to local host
nix shell --impure -I nixpkgs=channel:nixos-unstable --expr 'with import (builtins.findFile builtins.nixPath "nixpkgs") { config.allowUnfree = true; }; [ openssh ]' -c scp your_username@remoteIP:<filename> /some/local/directory
# Copy local directory to remote directory
nix shell --impure -I nixpkgs=channel:nixos-unstable --expr 'with import (builtins.findFile builtins.nixPath "nixpkgs") { config.allowUnfree = true; }; [ openssh ]' -c scp -r <local_dir> your_username@remoteIP:/some/remote/directory/<remote_dir>