Recursive scp without following links or creating a giant tar file?
So I did a recursive scp on my remote fileserver (in another state) and it created an infinite loop of links on my remote web directory...
http://www.linuxquestions.org/questions/linux-general-1/recursive-scp-w-o-following-links-658857/ says that I can can try creating a giant tar file. There is a problem with this though - I'm running the recursive scp on a Linux machine in my office, and I'm copying the files all to my external hard drive, which is in FAT32 format (because I need something that's readable by both UNIX and Windows). FAT32 doesn't support large filesizes. So I would have to try something different.
There's also a rsync option but the Linux machine in my office is very primitive (it's igel) so it doesn't have rsync...
symlink scp
add a comment |
So I did a recursive scp on my remote fileserver (in another state) and it created an infinite loop of links on my remote web directory...
http://www.linuxquestions.org/questions/linux-general-1/recursive-scp-w-o-following-links-658857/ says that I can can try creating a giant tar file. There is a problem with this though - I'm running the recursive scp on a Linux machine in my office, and I'm copying the files all to my external hard drive, which is in FAT32 format (because I need something that's readable by both UNIX and Windows). FAT32 doesn't support large filesizes. So I would have to try something different.
There's also a rsync option but the Linux machine in my office is very primitive (it's igel) so it doesn't have rsync...
symlink scp
add a comment |
So I did a recursive scp on my remote fileserver (in another state) and it created an infinite loop of links on my remote web directory...
http://www.linuxquestions.org/questions/linux-general-1/recursive-scp-w-o-following-links-658857/ says that I can can try creating a giant tar file. There is a problem with this though - I'm running the recursive scp on a Linux machine in my office, and I'm copying the files all to my external hard drive, which is in FAT32 format (because I need something that's readable by both UNIX and Windows). FAT32 doesn't support large filesizes. So I would have to try something different.
There's also a rsync option but the Linux machine in my office is very primitive (it's igel) so it doesn't have rsync...
symlink scp
So I did a recursive scp on my remote fileserver (in another state) and it created an infinite loop of links on my remote web directory...
http://www.linuxquestions.org/questions/linux-general-1/recursive-scp-w-o-following-links-658857/ says that I can can try creating a giant tar file. There is a problem with this though - I'm running the recursive scp on a Linux machine in my office, and I'm copying the files all to my external hard drive, which is in FAT32 format (because I need something that's readable by both UNIX and Windows). FAT32 doesn't support large filesizes. So I would have to try something different.
There's also a rsync option but the Linux machine in my office is very primitive (it's igel) so it doesn't have rsync...
symlink scp
symlink scp
edited Dec 9 '12 at 23:29
Gilles
528k12810581583
528k12810581583
asked Dec 9 '12 at 22:06
InquilineKea
1,87992841
1,87992841
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
I would not recommend using scp
for transferring large file trees directly,
because it does not handle neither hard nor soft links properly, also the stream is not compressed.
I'd recommend cpio
with (de)compression on the fly:
ssh user@host "cd /path/to/files && find . | cpio -ov | bzip2 -c" | bunzip2 -c | cpio -ivd
Also, find
can handle additional conditions, like "files must be less than 4G"
find . -size -4G | ...
To make cpio
more space-friendly (to handle spaces in file names properly) use
find . -print0 | cpio -0 -ivd | ...
add a comment |
You don't need to create the tar file before sending it. You can make it on the fly:
cd /source/dir
tar -cf - . | ssh 'cd /destination/directory && tar -xf -'
This does require that the remote server accept ssh shell connections, not just scp connections. In theory, it is possible to send arbitrary file trees to the remote side that don't correspond to anything like the local file structure, but I don't know of any existing tool to do this.
If symbolic links are a problem, you can make a copy of a directory tree that doesn't include symbolic links and that uses up negligible space, assuming the source tree is on a filesystem that supports hard links (so any native unix filesystem, or NTFS, but not FAT). I'm assuming GNU utilities here:
cd /source/dir
mkdir ../regular-files-only
cp -al . ../regular-files-only
find ../regular-file-only ! -type f ! -type d -delete
You could also use sftp. sftp -r
does not follow symbolic links, unlike scp -r
.
add a comment |
Another option is to use sftp -r
as sftp
manual https://www.computerhope.com/unix/sftp.htm says:
Recursively copy entire directories when uploading and downloading. Note that sftp does not follow symbolic links encountered in the tree traversal.
So
sftp -r source@surce_server.com:/source/dir .
does exactly what you want to do.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f58037%2frecursive-scp-without-following-links-or-creating-a-giant-tar-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would not recommend using scp
for transferring large file trees directly,
because it does not handle neither hard nor soft links properly, also the stream is not compressed.
I'd recommend cpio
with (de)compression on the fly:
ssh user@host "cd /path/to/files && find . | cpio -ov | bzip2 -c" | bunzip2 -c | cpio -ivd
Also, find
can handle additional conditions, like "files must be less than 4G"
find . -size -4G | ...
To make cpio
more space-friendly (to handle spaces in file names properly) use
find . -print0 | cpio -0 -ivd | ...
add a comment |
I would not recommend using scp
for transferring large file trees directly,
because it does not handle neither hard nor soft links properly, also the stream is not compressed.
I'd recommend cpio
with (de)compression on the fly:
ssh user@host "cd /path/to/files && find . | cpio -ov | bzip2 -c" | bunzip2 -c | cpio -ivd
Also, find
can handle additional conditions, like "files must be less than 4G"
find . -size -4G | ...
To make cpio
more space-friendly (to handle spaces in file names properly) use
find . -print0 | cpio -0 -ivd | ...
add a comment |
I would not recommend using scp
for transferring large file trees directly,
because it does not handle neither hard nor soft links properly, also the stream is not compressed.
I'd recommend cpio
with (de)compression on the fly:
ssh user@host "cd /path/to/files && find . | cpio -ov | bzip2 -c" | bunzip2 -c | cpio -ivd
Also, find
can handle additional conditions, like "files must be less than 4G"
find . -size -4G | ...
To make cpio
more space-friendly (to handle spaces in file names properly) use
find . -print0 | cpio -0 -ivd | ...
I would not recommend using scp
for transferring large file trees directly,
because it does not handle neither hard nor soft links properly, also the stream is not compressed.
I'd recommend cpio
with (de)compression on the fly:
ssh user@host "cd /path/to/files && find . | cpio -ov | bzip2 -c" | bunzip2 -c | cpio -ivd
Also, find
can handle additional conditions, like "files must be less than 4G"
find . -size -4G | ...
To make cpio
more space-friendly (to handle spaces in file names properly) use
find . -print0 | cpio -0 -ivd | ...
answered Dec 10 '12 at 11:39
Dmytro Sirenko
23614
23614
add a comment |
add a comment |
You don't need to create the tar file before sending it. You can make it on the fly:
cd /source/dir
tar -cf - . | ssh 'cd /destination/directory && tar -xf -'
This does require that the remote server accept ssh shell connections, not just scp connections. In theory, it is possible to send arbitrary file trees to the remote side that don't correspond to anything like the local file structure, but I don't know of any existing tool to do this.
If symbolic links are a problem, you can make a copy of a directory tree that doesn't include symbolic links and that uses up negligible space, assuming the source tree is on a filesystem that supports hard links (so any native unix filesystem, or NTFS, but not FAT). I'm assuming GNU utilities here:
cd /source/dir
mkdir ../regular-files-only
cp -al . ../regular-files-only
find ../regular-file-only ! -type f ! -type d -delete
You could also use sftp. sftp -r
does not follow symbolic links, unlike scp -r
.
add a comment |
You don't need to create the tar file before sending it. You can make it on the fly:
cd /source/dir
tar -cf - . | ssh 'cd /destination/directory && tar -xf -'
This does require that the remote server accept ssh shell connections, not just scp connections. In theory, it is possible to send arbitrary file trees to the remote side that don't correspond to anything like the local file structure, but I don't know of any existing tool to do this.
If symbolic links are a problem, you can make a copy of a directory tree that doesn't include symbolic links and that uses up negligible space, assuming the source tree is on a filesystem that supports hard links (so any native unix filesystem, or NTFS, but not FAT). I'm assuming GNU utilities here:
cd /source/dir
mkdir ../regular-files-only
cp -al . ../regular-files-only
find ../regular-file-only ! -type f ! -type d -delete
You could also use sftp. sftp -r
does not follow symbolic links, unlike scp -r
.
add a comment |
You don't need to create the tar file before sending it. You can make it on the fly:
cd /source/dir
tar -cf - . | ssh 'cd /destination/directory && tar -xf -'
This does require that the remote server accept ssh shell connections, not just scp connections. In theory, it is possible to send arbitrary file trees to the remote side that don't correspond to anything like the local file structure, but I don't know of any existing tool to do this.
If symbolic links are a problem, you can make a copy of a directory tree that doesn't include symbolic links and that uses up negligible space, assuming the source tree is on a filesystem that supports hard links (so any native unix filesystem, or NTFS, but not FAT). I'm assuming GNU utilities here:
cd /source/dir
mkdir ../regular-files-only
cp -al . ../regular-files-only
find ../regular-file-only ! -type f ! -type d -delete
You could also use sftp. sftp -r
does not follow symbolic links, unlike scp -r
.
You don't need to create the tar file before sending it. You can make it on the fly:
cd /source/dir
tar -cf - . | ssh 'cd /destination/directory && tar -xf -'
This does require that the remote server accept ssh shell connections, not just scp connections. In theory, it is possible to send arbitrary file trees to the remote side that don't correspond to anything like the local file structure, but I don't know of any existing tool to do this.
If symbolic links are a problem, you can make a copy of a directory tree that doesn't include symbolic links and that uses up negligible space, assuming the source tree is on a filesystem that supports hard links (so any native unix filesystem, or NTFS, but not FAT). I'm assuming GNU utilities here:
cd /source/dir
mkdir ../regular-files-only
cp -al . ../regular-files-only
find ../regular-file-only ! -type f ! -type d -delete
You could also use sftp. sftp -r
does not follow symbolic links, unlike scp -r
.
answered Dec 9 '12 at 23:29
Gilles
528k12810581583
528k12810581583
add a comment |
add a comment |
Another option is to use sftp -r
as sftp
manual https://www.computerhope.com/unix/sftp.htm says:
Recursively copy entire directories when uploading and downloading. Note that sftp does not follow symbolic links encountered in the tree traversal.
So
sftp -r source@surce_server.com:/source/dir .
does exactly what you want to do.
add a comment |
Another option is to use sftp -r
as sftp
manual https://www.computerhope.com/unix/sftp.htm says:
Recursively copy entire directories when uploading and downloading. Note that sftp does not follow symbolic links encountered in the tree traversal.
So
sftp -r source@surce_server.com:/source/dir .
does exactly what you want to do.
add a comment |
Another option is to use sftp -r
as sftp
manual https://www.computerhope.com/unix/sftp.htm says:
Recursively copy entire directories when uploading and downloading. Note that sftp does not follow symbolic links encountered in the tree traversal.
So
sftp -r source@surce_server.com:/source/dir .
does exactly what you want to do.
Another option is to use sftp -r
as sftp
manual https://www.computerhope.com/unix/sftp.htm says:
Recursively copy entire directories when uploading and downloading. Note that sftp does not follow symbolic links encountered in the tree traversal.
So
sftp -r source@surce_server.com:/source/dir .
does exactly what you want to do.
answered Dec 18 at 12:13
rRr
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f58037%2frecursive-scp-without-following-links-or-creating-a-giant-tar-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown