{"id":2858,"date":"2023-06-21T15:43:37","date_gmt":"2023-06-21T15:43:37","guid":{"rendered":"https:\/\/www.copahost.com\/blog\/?p=2858"},"modified":"2026-06-02T12:30:05","modified_gmt":"2026-06-02T12:30:05","slug":"scp-for-directory","status":"publish","type":"post","link":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/","title":{"rendered":"SCP for directory: directory file transfers in Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_69_1 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#What_is_SCP_for_directory\" title=\"What is SCP for directory?\">What is SCP for directory?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#SCP_command_syntax_for_directories\" title=\"SCP command syntax for directories\">SCP command syntax for directories<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#Useful_SCP_flags\" title=\"Useful SCP flags\">Useful SCP flags<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#Uploading_and_downloading_directories\" title=\"Uploading and downloading directories\">Uploading and downloading directories<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#Alternatives_to_SCP_for_directory\" title=\"Alternatives to SCP for directory\">Alternatives to SCP for directory<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#Rsync_to_copy_an_entire_directory\" title=\"Rsync to copy an entire directory\">Rsync to copy an entire directory<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#tar_SSH\" title=\"tar + SSH\">tar + SSH<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#SFTP\" title=\"SFTP\">SFTP<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#The_difference_between_SCP_and_SSH\" title=\"The difference between SCP and SSH\">The difference between SCP and SSH<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#Is_SCP_still_safe_to_use\" title=\"Is SCP still safe to use?\">Is SCP still safe to use?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#Performance_while_transferring_a_whole_directory_using_SCP\" title=\"Performance while transferring a whole directory using SCP\">Performance while transferring a whole directory using SCP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#Frequently_asked_questions\" title=\"Frequently asked questions\">Frequently asked questions<\/a><\/li><\/ul><\/nav><\/div>\n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_SCP_for_directory\"><\/span>What is SCP for directory?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SCP (Secure Copy) can transfer a whole directory, including its files and subdirectories. SCP supports recursive copying, which allows you to transfer an entire directory structure from a source location to a destination location.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To transfer a directory using SCP, you can <strong>use the &#8220;-r&#8221; flag<\/strong>, which stands for recursive. The recursive flag tells SCP to <strong>copy the directory and all its contents<\/strong>, including subdirectories and files. Here&#8217;s an example of how to use SCP to transfer a directory:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">scp -r &#091;source_directory] &#091;username]@&#091;destination_host]:&#091;destination_directory]<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">When you run the command, SCP will recursively copy the entire directory and its contents to the specified destination directory on the remote server. You may be prompted to enter the password for the destination server&#8217;s username, or if you have <a href=\"https:\/\/www.copahost.com\/blog\/port-22\/\">SSH<\/a> key-based authentication set up, you may not need to enter a password.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"SCP_command_syntax_for_directories\"><\/span>SCP command syntax for directories<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To use the SCP (Secure Copy) command to transfer an entire directory, you can follow these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open a terminal or command prompt on your local machine and <strong>navigate to the directory<\/strong> where you want to copy the directory from.<\/li>\n\n\n\n<li>Use the following SCP command syntax:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">scp -r &#091;source_directory] &#091;username]@&#091;destination_host]:&#091;destination_directory]<\/code><\/span><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Replace <strong>[source_directory]<\/strong> with the path to the directory you want to copy. Specify [username] as the username on the destination server,<strong> [destination_host]<\/strong> as the IP address or hostname of the destination server, and <strong>[destination_directory]<\/strong> as the path where you want to copy the directory to.<\/li>\n\n\n\n<li>Enter the password for the destination server&#8217;s username when prompted. If you have SSH key-based authentication set up, you may not need to enter a password.<\/li>\n\n\n\n<li>The SCP command will start copying the entire directory and its contents recursively to the destination server. You&#8217;ll see the progress and file transfer details in the terminal.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Once the SCP command completes, the entire directory and its contents will be transferred to the specified destination directory on the remote server.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Ensure that you have proper permissions and access rights on both the source and destination directories to perform the SCP transfer. Otherwise, you can have a <a href=\"https:\/\/www.copahost.com\/blog\/scp-permission-denied\/\">SCP permission denied error<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Useful_SCP_flags\"><\/span>Useful SCP flags<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Beyond <code>-r<\/code> for recursive copying, a few flags make SCP more practical for everyday transfers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>-P [port]<\/code><\/strong> \u2014 connects to a custom SSH port. This trips up many users: the port flag in SCP is an <strong>uppercase <code>-P<\/code><\/strong> (lowercase <code>-p<\/code> does something else). Use it whenever the server&#8217;s SSH isn&#8217;t on the default port 22.<\/li>\n\n\n\n<li><strong><code>-p<\/code><\/strong> \u2014 preserves the original modification times, access times, and permissions of the files.<\/li>\n\n\n\n<li><strong><code>-C<\/code><\/strong> \u2014 compresses the data during transfer, which can speed things up over slower connections.<\/li>\n\n\n\n<li><strong><code>-v<\/code><\/strong> \u2014 verbose mode, printing debug output. Useful when a transfer fails and you need to see where it breaks.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You can combine them. For example, to copy a directory over a custom port (2222), preserving attributes and showing progress:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">scp -rpv -P <span class=\"hljs-number\">2222<\/span> .\/mysite user@<span class=\"hljs-number\">203.0<\/span><span class=\"hljs-number\">.113<\/span><span class=\"hljs-number\">.10<\/span>:<span class=\"hljs-regexp\">\/var\/<\/span>www\/<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"512\" height=\"512\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory-B.png\" alt=\"\" class=\"wp-image-2863\" srcset=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory-B.png 512w, https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory-B-300x300.png 300w, https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory-B-150x150.png 150w, https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory-B-50x50.png 50w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Uploading_and_downloading_directories\"><\/span>Uploading and downloading directories<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The direction of the copy depends simply on the order of the arguments \u2014 local-to-remote uploads, remote-to-local downloads.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Upload<\/strong> a local directory to the server:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">scp -r .\/mysite user@<span class=\"hljs-number\">203.0<\/span><span class=\"hljs-number\">.113<\/span><span class=\"hljs-number\">.10<\/span>:<span class=\"hljs-regexp\">\/var\/<\/span>www\/<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Download<\/strong> a directory from the server to your local machine (just swap the order \u2014 remote first, local second):<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">scp -r user@<span class=\"hljs-number\">203.0<\/span><span class=\"hljs-number\">.113<\/span><span class=\"hljs-number\">.10<\/span>:<span class=\"hljs-regexp\">\/var\/<\/span>www\/mysite .\/<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The trailing <code>.\/<\/code> means &#8220;the current local folder.&#8221; You can replace it with any local path, such as <code>\/home\/user\/backups\/<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Alternatives_to_SCP_for_directory\"><\/span>Alternatives to SCP for directory<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These alternatives provide flexibility and additional features for copying directories, allowing you to choose the method that best suits your requirements and preferences.<\/p>\n\n\n\n<link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/@tabler\/icons-webfont@latest\/tabler-icons.min.css\">\n\n<style>\n  .t-wrap { overflow-x: auto; }\n  table { width: 100%; border-collapse: collapse; min-width: 640px; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }\n  thead tr { background: #f9fafb; }\n  th { padding: 11px 14px; text-align: left; font-weight: 500; color: #6b7280; border-bottom: 1px solid #e5e7eb; }\n  th:first-child { width: 20%; }\n  td { padding: 11px 14px; border-bottom: 1px solid #f3f4f6; color: #111827; vertical-align: top; line-height: 1.45; }\n  tbody tr:last-child td { border-bottom: none; }\n  tbody tr:hover td { background: #f9fafb; }\n  .tool { display: flex; align-items: center; gap: 8px; font-weight: 600; }\n  .tool-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }\n  .tool-icon i { font-size: 15px; }\n  .mono { font-family: monospace; font-size: 12.5px; color: #6b7280; }\n  .pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; }\n  .p-yes { background: #EAF3DE; color: #27500A; }\n  .p-no { background: #FCEBEB; color: #791F1F; }\n<\/style>\n\n<div class=\"t-wrap\">\n  <table>\n    <thead>\n      <tr>\n        <th>Tool<\/th>\n        <th>Best for<\/th>\n        <th>Speed on large transfers<\/th>\n        <th>Resumes if interrupted?<\/th>\n        <th>Ease of use<\/th>\n      <\/tr>\n    <\/thead>\n    <tbody>\n      <tr>\n        <td><div class=\"tool\"><span class=\"tool-icon\" style=\"background:#E6F1FB;\"><i class=\"ti ti-copy\" style=\"color:#185FA5;\"><\/i><\/span>SCP<\/div><\/td>\n        <td>Quick, one-off directory copies<\/td>\n        <td>Good<\/td>\n        <td><span class=\"pill p-no\">No<\/span><\/td>\n        <td>Very easy \u2014 one command<\/td>\n      <\/tr>\n      <tr>\n        <td><div class=\"tool\"><span class=\"tool-icon\" style=\"background:#EAF3DE;\"><i class=\"ti ti-refresh\" style=\"color:#3B6D11;\"><\/i><\/span>rsync<\/div><\/td>\n        <td>Recurring syncs, backups, large dirs<\/td>\n        <td>Excellent (delta transfer)<\/td>\n        <td><span class=\"pill p-yes\">Yes<\/span><\/td>\n        <td>Easy, more flags to learn<\/td>\n      <\/tr>\n      <tr>\n        <td><div class=\"tool\"><span class=\"tool-icon\" style=\"background:#FAEEDA;\"><i class=\"ti ti-package\" style=\"color:#854F0B;\"><\/i><\/span>tar + SSH<\/div><\/td>\n        <td>Many small files at once<\/td>\n        <td>Very good (single archive)<\/td>\n        <td><span class=\"pill p-no\">No<\/span><\/td>\n        <td>Moderate \u2014 multi-step<\/td>\n      <\/tr>\n      <tr>\n        <td><div class=\"tool\"><span class=\"tool-icon\" style=\"background:#EEEDFE;\"><i class=\"ti ti-folder\" style=\"color:#534AB7;\"><\/i><\/span>SFTP<\/div><\/td>\n        <td>Interactive browsing &#038; transfers<\/td>\n        <td>Good<\/td>\n        <td><span class=\"pill p-yes\">Yes<\/span><\/td>\n        <td>Easy \u2014 interactive session<\/td>\n      <\/tr>\n    <\/tbody>\n  <\/table>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Rsync_to_copy_an_entire_directory\"><\/span>Rsync to copy an entire directory<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Rsync is the most popular alternative to SCP for directories, and often the better choice. Its key advantage is <strong>delta transfer<\/strong>: it compares source and destination and copies only what changed, instead of resending everything. That makes it much faster for repeated transfers, large directories, or syncing backups.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It also preserves permissions and timestamps, compresses data in transit, and can <strong>resume interrupted transfers<\/strong> \u2014 picking up where it stopped instead of starting over. For ongoing syncs or unreliable connections, rsync is hard to beat.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example of using <a href=\"https:\/\/rsync.samba.org\/how-rsync-works.html\">rsync<\/a> to copy a directory:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">rsync<\/span> <span class=\"hljs-selector-tag\">-av<\/span> <span class=\"hljs-selector-attr\">&#091;source_directory]<\/span> <span class=\"hljs-selector-attr\">&#091;destination_host]<\/span>:<span class=\"hljs-selector-attr\">&#091;destination_directory]<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The <strong><code>-a<\/code> <\/strong>flag (archive) preserves permissions, timestamps, and structure; <strong><code>-v<\/code> <\/strong>(verbose) shows the progress. Add <code>-z<\/code> to compress during transfer, or <strong><code>--progress<\/code> <\/strong>for a detailed view.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"tar_SSH\"><\/span>tar + SSH<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When transferring many small files, bundling them into a single compressed archive first is often faster than copying them one by one. The <code>tar<\/code> command packs a whole directory into one file (a &#8220;tarball&#8221;), preserving its structure and permissions, and you pipe it over SSH to the destination.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This approach shines on directories with thousands of small files, where the per-file overhead of SCP or SFTP slows things down.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># Creating the archive<\/span>\ntar -czf archive.tar.gz &#091;source_directory]\n\n<span class=\"hljs-comment\"># Copying the archive via SSH<\/span>\nscp archive.tar.gz &#091;username]@&#091;destination_host]:&#091;destination_directory]\n\n<span class=\"hljs-comment\"># Extracting the archive on the destination<\/span>\nssh &#091;username]@&#091;destination_host] <span class=\"hljs-string\">\"tar -xzf &#091;destination_directory]\/archive.tar.gz -C &#091;destination_directory]\"<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">In the <code>tar<\/code> flags, <code><strong>-c<\/strong><\/code> creates, <strong><code>-z<\/code> <\/strong>compresses with gzip, and <strong><code>-f<\/code> <\/strong>sets the filename; on extraction, <code><strong>-x<\/strong><\/code> extracts and <code><strong>-C<\/strong><\/code> sets the target folder.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"SFTP\"><\/span>SFTP<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you have SSH access to the remote server, you can use <a href=\"https:\/\/www.copahost.com\/blog\/sftp-vs-ftps\/\">SFTP<\/a> (SSH File Transfer Protocol) to copy directories interactively via <a href=\"https:\/\/www.copahost.com\/blog\/port-22\/\">port 22<\/a>. It&#8217;s similar to <a href=\"https:\/\/www.copahost.com\/blog\/ftp-meaning\/\">FTP<\/a>, but with a security layer. SFTP provides a more user-friendly interface compared to SCP. Here&#8217;s an example of using SFTP to copy a directory:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">sftp<\/span> <span class=\"hljs-selector-attr\">&#091;username]<\/span>@&#091;destination_host]\n# Enter password if prompted\n\nsftp&gt; put -r &#091;source_directory] &#091;destination_directory]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Using SFTP, you can navigate the local and remote directories, transfer files and directories, and manage permissions and attributes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_difference_between_SCP_and_SSH\"><\/span>The difference between SCP and SSH<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The two are related but not the same: <strong>SSH is the secure channel, and SCP is a tool that travels through it.<\/strong> SSH (Secure Shell) provides the encrypted connection between two machines, used for remote login and as the transport layer for other tools. SCP (Secure Copy) is built on top of SSH specifically to copy files and directories over that connection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In practice, it works like this: when you run an SCP command, it opens an SSH connection to the server and authenticates you (by password or SSH key). Once the secure channel is established, SCP transfers your files through it \u2014 encrypting the data in transit and verifying its integrity on arrival, so the files can&#8217;t be read or tampered with along the way.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In short, SSH is <em>how<\/em> the secure connection happens; SCP is <em>what<\/em> uses that connection to move your files.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Is_SCP_still_safe_to_use\"><\/span>Is SCP still safe to use?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Worth knowing: the <strong>SCP protocol is considered legacy<\/strong>. Because of security weaknesses that are hard to fix without breaking compatibility (such as CVE-2020-15778), the OpenSSH developers deprecated the old SCP protocol in <strong>OpenSSH 9.0 (April 2022)<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In practice, this doesn&#8217;t mean the <code>scp<\/code> command stopped working. Since OpenSSH 9.0, the <code>scp<\/code> command still exists, but it <strong>uses the SFTP protocol under the hood by default<\/strong> instead of the old SCP protocol. For everyday transfers, you can keep using <code>scp<\/code> exactly as shown in this guide.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you specifically need the old protocol \u2014 for example, to connect to a very old server \u2014 you can force it with the uppercase <strong><code>-O<\/code><\/strong> flag. But for new workflows, the recommendation is to prefer <strong>SFTP<\/strong> or <strong>rsync<\/strong>, both of which are more modern and actively maintained.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Performance_while_transferring_a_whole_directory_using_SCP\"><\/span>Performance while transferring a whole directory using SCP<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For a single, one-off copy, SCP and rsync perform similarly \u2014 SCP is simple and does the job. The difference shows up on <strong>repeated transfers and large directories<\/strong>, where rsync is generally faster for three reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Delta transfer:<\/strong> rsync compares source and destination and copies only what changed, instead of resending the whole directory every time. On a folder you sync regularly, this is a dramatic difference.<\/li>\n\n\n\n<li><strong>Compression:<\/strong> rsync can compress data in transit (the <code>-z<\/code> flag), reducing transfer time over slower connections.<\/li>\n\n\n\n<li><strong>Resumable transfers:<\/strong> if the connection drops, rsync picks up where it left off rather than starting over \u2014 valuable on large transfers or unstable networks.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">So the choice comes down to the task: use <strong>SCP<\/strong> for quick, one-time copies where simplicity matters, and <strong>rsync<\/strong> for recurring syncs, backups, or large directories where efficiency pays off. And as noted above, since the SCP protocol is now legacy, both rsync and SFTP are the recommended choices for new workflows.<\/p>\n\n\n\n<link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/@tabler\/icons-webfont@latest\/tabler-icons.min.css\">\n\n<style>\n  .cta-box {\n    margin: 1.5rem 0;\n    background: linear-gradient(135deg, #0C447C 0%, #185FA5 100%);\n    border-radius: 16px;\n    padding: 28px;\n    display: flex;\n    align-items: center;\n    gap: 22px;\n    flex-wrap: wrap;\n  }\n  .cta-icon {\n    width: 56px; height: 56px;\n    background: rgba(255,255,255,0.14);\n    border-radius: 12px;\n    display: flex; align-items: center; justify-content: center;\n    flex-shrink: 0;\n  }\n  .cta-icon i { font-size: 28px; color: #fff; }\n  .cta-content { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }\n  .cta-title { font-weight: 600; color: #fff; line-height: 1.3; font-size: 1.15rem; }\n  .cta-text { color: #C5DDF4; line-height: 1.55; }\n  .cta-perks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }\n  .cta-perk {\n    display: inline-flex; align-items: center; gap: 5px;\n    background: rgba(255,255,255,0.12);\n    color: #E6F1FB;\n    border-radius: 99px;\n    padding: 3px 10px;\n    font-size: .85rem;\n  }\n  .cta-perk i { font-size: 13px; }\n  .cta-btn {\n    display: inline-flex; align-items: center; gap: 8px;\n    background: #fff;\n    color: #0C447C !important;\n    border-radius: 8px;\n    padding: 13px 22px;\n    font-weight: 600;\n    text-decoration: none !important;\n    white-space: nowrap;\n    flex-shrink: 0;\n  }\n  .cta-btn:hover { background: #E6F1FB; }\n  .cta-btn i { font-size: 17px; }\n<\/style>\n\n<div class=\"cta-box\">\n  <div class=\"cta-icon\"><i class=\"ti ti-terminal-2\"><\/i><\/div>\n  <div class=\"cta-content\">\n    <span class=\"cta-title\">Need a server with full SSH access?<\/span>\n    <span class=\"cta-text\">SCP, rsync, and SFTP all need a server you fully control. Copahost&#8217;s Cloud and VPS plans give you root SSH access, NVMe storage, and our own data center \u2014 ready for your transfers and deployments.<\/span>\n    <div class=\"cta-perks\">\n      <span class=\"cta-perk\"><i class=\"ti ti-key\"><\/i> Root SSH access<\/span>\n      <span class=\"cta-perk\"><i class=\"ti ti-bolt\"><\/i> NVMe storage<\/span>\n      <span class=\"cta-perk\"><i class=\"ti ti-building-broadcast-tower\"><\/i> Own data center<\/span>\n    <\/div>\n  <\/div>\n  <a class=\"cta-btn\" href=\"https:\/\/www.copahost.com\/en\/vps-hosting\" target=\"_blank\">\n    <i class=\"ti ti-arrow-right\"><\/i> View VPS &#038; Cloud plans\n  <\/a>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Frequently_asked_questions\"><\/span>Frequently asked questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/@tabler\/icons-webfont@latest\/tabler-icons.min.css\">\n\n<style>\n  .faq-section { margin: 1.5rem 0; }\n  .faq-item { border: 1px solid #e5e7eb; border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: #fff; }\n  .faq-item[open] { border-color: #d1d5db; }\n  .faq-question { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; font-weight: 500; color: #111827; list-style: none; }\n  .faq-question::-webkit-details-marker { display: none; }\n  .faq-q-icon { width: 30px; height: 30px; background: #E6F1FB; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }\n  .faq-q-icon i { color: #185FA5; font-size: 17px; }\n  .faq-chevron { margin-left: auto; color: #9ca3af; transition: transform .2s; flex-shrink: 0; }\n  .faq-item[open] .faq-chevron { transform: rotate(180deg); }\n  .faq-answer { padding: 0 18px 16px 60px; color: #4b5563; line-height: 1.6; }\n  .faq-answer strong { color: #111827; }\n  .faq-answer code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-family: monospace; }\n<\/style>\n\n<div class=\"faq-section\">\n\n  <details class=\"faq-item\">\n    <summary class=\"faq-question\">\n      <span class=\"faq-q-icon\"><i class=\"ti ti-help\"><\/i><\/span>\n      How do I copy an entire folder with SCP?\n      <i class=\"ti ti-chevron-down faq-chevron\"><\/i>\n    <\/summary>\n    <div class=\"faq-answer\">\n      Use the <code>-r<\/code> (recursive) flag, which copies the directory and everything inside it: <code>scp -r .\/mysite user@host:\/var\/www\/<\/code>. Without <code>-r<\/code>, SCP only copies single files, not folders.\n    <\/div>\n  <\/details>\n\n  <details class=\"faq-item\">\n    <summary class=\"faq-question\">\n      <span class=\"faq-q-icon\"><i class=\"ti ti-help\"><\/i><\/span>\n      What does scp -r do?\n      <i class=\"ti ti-chevron-down faq-chevron\"><\/i>\n    <\/summary>\n    <div class=\"faq-answer\">\n      The <code>-r<\/code> flag stands for <strong>recursive<\/strong>. It tells SCP to copy a directory along with all its subdirectories and files, preserving the folder structure at the destination.\n    <\/div>\n  <\/details>\n\n  <details class=\"faq-item\">\n    <summary class=\"faq-question\">\n      <span class=\"faq-q-icon\"><i class=\"ti ti-help\"><\/i><\/span>\n      How do I download a directory from a remote server with SCP?\n      <i class=\"ti ti-chevron-down faq-chevron\"><\/i>\n    <\/summary>\n    <div class=\"faq-answer\">\n      Just reverse the order of the arguments \u2014 put the remote path first and the local path second: <code>scp -r user@host:\/var\/www\/mysite .\/<\/code>. The trailing <code>.\/<\/code> means the current local folder.\n    <\/div>\n  <\/details>\n\n  <details class=\"faq-item\">\n    <summary class=\"faq-question\">\n      <span class=\"faq-q-icon\"><i class=\"ti ti-help\"><\/i><\/span>\n      How do I use SCP with a different port?\n      <i class=\"ti ti-chevron-down faq-chevron\"><\/i>\n    <\/summary>\n    <div class=\"faq-answer\">\n      Use the uppercase <code>-P<\/code> flag followed by the port number: <code>scp -P 2222 -r .\/mysite user@host:\/var\/www\/<\/code>. Note it&#8217;s an uppercase <strong>-P<\/strong> in SCP (lowercase <code>-p<\/code> preserves timestamps instead) \u2014 a common source of errors.\n    <\/div>\n  <\/details>\n\n  <details class=\"faq-item\">\n    <summary class=\"faq-question\">\n      <span class=\"faq-q-icon\"><i class=\"ti ti-help\"><\/i><\/span>\n      SCP vs rsync: which one should I use?\n      <i class=\"ti ti-chevron-down faq-chevron\"><\/i>\n    <\/summary>\n    <div class=\"faq-answer\">\n      Use <strong>SCP<\/strong> for quick, one-time copies where simplicity matters. Use <strong>rsync<\/strong> for recurring syncs, backups, or large directories \u2014 its delta transfer only copies what changed, making it faster and resumable.\n    <\/div>\n  <\/details>\n\n  <details class=\"faq-item\">\n    <summary class=\"faq-question\">\n      <span class=\"faq-q-icon\"><i class=\"ti ti-help\"><\/i><\/span>\n      Is SCP deprecated or still safe to use?\n      <i class=\"ti ti-chevron-down faq-chevron\"><\/i>\n    <\/summary>\n    <div class=\"faq-answer\">\n      The legacy SCP <strong>protocol<\/strong> was deprecated in OpenSSH 9.0 (2022), but the <code>scp<\/code> command still works \u2014 it now uses the SFTP protocol under the hood by default. You can keep using it for everyday transfers, though SFTP and rsync are the recommended choices for new workflows.\n    <\/div>\n  <\/details>\n\n<\/div>\n\n\n\n\n<script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntity\": [\n    {\n      \"@type\": \"Question\",\n      \"name\": \"How do I copy an entire folder with SCP?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Use the -r (recursive) flag, which copies the directory and everything inside it: scp -r .\/mysite user@host:\/var\/www\/. Without -r, SCP only copies single files, not folders.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"What does scp -r do?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"The -r flag stands for recursive. It tells SCP to copy a directory along with all its subdirectories and files, preserving the folder structure at the destination.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"How do I download a directory from a remote server with SCP?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Just reverse the order of the arguments \u2014 put the remote path first and the local path second: scp -r user@host:\/var\/www\/mysite .\/. The trailing .\/ means the current local folder.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"How do I use SCP with a different port?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Use the uppercase -P flag followed by the port number: scp -P 2222 -r .\/mysite user@host:\/var\/www\/. Note it's an uppercase -P in SCP (lowercase -p preserves timestamps instead), a common source of errors.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"SCP vs rsync: which one should I use?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Use SCP for quick, one-time copies where simplicity matters. Use rsync for recurring syncs, backups, or large directories \u2014 its delta transfer only copies what changed, making it faster and resumable.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"Is SCP deprecated or still safe to use?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"The legacy SCP protocol was deprecated in OpenSSH 9.0 (2022), but the scp command still works \u2014 it now uses the SFTP protocol under the hood by default. You can keep using it for everyday transfers, though SFTP and rsync are the recommended choices for new workflows.\"\n      }\n    }\n  ]\n}\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>What is SCP for directory? SCP (Secure Copy) can transfer a whole directory, including its files and subdirectories. SCP supports recursive copying, which allows you to transfer an entire directory structure from a source location to a destination location. To transfer a directory using SCP, you can use the &#8220;-r&#8221; flag, which stands for recursive. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2864,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-2858","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SCP for directory: directory file transfers in Linux - Copahost<\/title>\n<meta name=\"description\" content=\"How to copy an entire directory using SCP for directory. SCP uses the SSH port to transfer files and folders, from a server to another.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SCP for directory: directory file transfers in Linux - Copahost\" \/>\n<meta property=\"og:description\" content=\"How to copy an entire directory using SCP for directory. SCP uses the SSH port to transfer files and folders, from a server to another.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/\" \/>\n<meta property=\"og:site_name\" content=\"Copahost\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-21T15:43:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-02T12:30:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Gustavo Gallas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gustavo Gallas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/\"},\"author\":{\"name\":\"Gustavo Gallas\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\"},\"headline\":\"SCP for directory: directory file transfers in Linux\",\"datePublished\":\"2023-06-21T15:43:37+00:00\",\"dateModified\":\"2026-06-02T12:30:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/\"},\"wordCount\":1635,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png\",\"articleSection\":[\"Linux tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/\",\"name\":\"SCP for directory: directory file transfers in Linux - Copahost\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png\",\"datePublished\":\"2023-06-21T15:43:37+00:00\",\"dateModified\":\"2026-06-02T12:30:05+00:00\",\"description\":\"How to copy an entire directory using SCP for directory. SCP uses the SSH port to transfer files and folders, from a server to another.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png\",\"width\":512,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.copahost.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SCP for directory: directory file transfers in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"name\":\"Copahost\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.copahost.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\",\"name\":\"Copahost\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"width\":223,\"height\":40,\"caption\":\"Copahost\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\",\"name\":\"Gustavo Gallas\",\"description\":\"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/\"],\"url\":\"https:\/\/www.copahost.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SCP for directory: directory file transfers in Linux - Copahost","description":"How to copy an entire directory using SCP for directory. SCP uses the SSH port to transfer files and folders, from a server to another.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/","og_locale":"en_US","og_type":"article","og_title":"SCP for directory: directory file transfers in Linux - Copahost","og_description":"How to copy an entire directory using SCP for directory. SCP uses the SSH port to transfer files and folders, from a server to another.","og_url":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/","og_site_name":"Copahost","article_published_time":"2023-06-21T15:43:37+00:00","article_modified_time":"2026-06-02T12:30:05+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png","type":"image\/png"}],"author":"Gustavo Gallas","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Gustavo Gallas","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#article","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/"},"author":{"name":"Gustavo Gallas","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246"},"headline":"SCP for directory: directory file transfers in Linux","datePublished":"2023-06-21T15:43:37+00:00","dateModified":"2026-06-02T12:30:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/"},"wordCount":1635,"commentCount":0,"publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png","articleSection":["Linux tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.copahost.com\/blog\/scp-for-directory\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/","url":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/","name":"SCP for directory: directory file transfers in Linux - Copahost","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png","datePublished":"2023-06-21T15:43:37+00:00","dateModified":"2026-06-02T12:30:05+00:00","description":"How to copy an entire directory using SCP for directory. SCP uses the SSH port to transfer files and folders, from a server to another.","breadcrumb":{"@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.copahost.com\/blog\/scp-for-directory\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#primaryimage","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2023\/06\/scp-directory.png","width":512,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.copahost.com\/blog\/scp-for-directory\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.copahost.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SCP for directory: directory file transfers in Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.copahost.com\/blog\/#website","url":"https:\/\/www.copahost.com\/blog\/","name":"Copahost","description":"","publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.copahost.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.copahost.com\/blog\/#organization","name":"Copahost","url":"https:\/\/www.copahost.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","width":223,"height":40,"caption":"Copahost"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246","name":"Gustavo Gallas","description":"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.","sameAs":["https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/"],"url":"https:\/\/www.copahost.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/2858","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/comments?post=2858"}],"version-history":[{"count":12,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/2858\/revisions"}],"predecessor-version":[{"id":4459,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/2858\/revisions\/4459"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/media\/2864"}],"wp:attachment":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/media?parent=2858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/categories?post=2858"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/tags?post=2858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}