{"id":1140,"date":"2020-12-16T07:26:20","date_gmt":"2020-12-16T07:26:20","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2020\/12\/16\/4725353-how-to-copy-files-or-folders-using-ssh-at-hostinger\/"},"modified":"2026-03-16T12:12:12","modified_gmt":"2026-03-16T12:12:12","slug":"4725353-how-to-copy-files-or-folders-using-ssh-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/4725353-how-to-copy-files-or-folders-using-ssh-at-hostinger\/","title":{"rendered":"How to Copy Files or Folders Using SSH at Hostinger"},"content":{"rendered":"<p class=\"no-margin\">Copying files and folders is possible using the<b> <a href=\"\/support\/4548688-basic-actions-in-file-manager\" target=\"_blank\" class=\"intercom-content-link\">file manager<\/a><\/b>:<\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2020\/12\/76ec0593-70a8-49a0-a4c3-93c7c63b922b.jpg\" width=\"471\"><\/div><p class=\"no-margin\">If you would like to copy files and folders with <b>SSH<\/b>, follow these steps&#128071; <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_8720afae7a\">Step 1 &ndash; Connection<\/h2><p class=\"no-margin\">First, <b><a href=\"\/support\/1583645-do-i-get-ssh-access-how-to-enable-ssh-access\" target=\"_blank\" class=\"intercom-content-link\">enable SSH access<\/a><\/b> and <b><a href=\"\/support\/1583245-how-can-i-connect-to-my-account-via-ssh\" target=\"_blank\" class=\"intercom-content-link\">connect to your account using SSH<\/a><\/b>. Open the directory, where the files and folders, which you want to copy, are located. For that:<\/p><ol>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/5973000-how-to-open-the-website-s-root-directory-via-ssh\" target=\"_blank\" class=\"intercom-content-link\">Open your website&rsquo;s root directory<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">Run <code>ls<\/code> command<\/p>\n<ol>\n<li>\n<p class=\"no-margin\">If you see the needed files and folders, then you can go to <b><a href=\"#h_02bb0ba9e5\" target=\"_blank\" class=\"intercom-content-link\">Step 2<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">If the needed content is in a subdirectory, reach it by running the below command where <code>path\/to\/files<\/code> is the actual path to your files:<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol><pre><code>cd path\/to\/files<\/code><\/pre><p class=\"no-margin\">For example, if your files are located in <code>public_html\/new\/version1<\/code>, then the command should be <code>cd new\/version1<\/code>.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_02bb0ba9e5\">Step 2 &ndash; Copying<\/h2><p class=\"no-margin\">You only need one command to copy files or folders, just chose the option the most suitable for you: <\/p><ul>\n<li>\n<p class=\"no-margin\">Make a <b>copy of the file<\/b>: <\/p>\n<\/li>\n<\/ul><pre><code>cp filename<\/code><\/pre><ul>\n<li>\n<p class=\"no-margin\">Make a <b>copy and rename<\/b> the copied file: <\/p>\n<\/li>\n<\/ul><pre><code>cp filename.php newfilename.php<\/code><\/pre><ul>\n<li>\n<p class=\"no-margin\"><b>Move the copied file <\/b>to a separate directory:<\/p>\n<\/li>\n<\/ul><pre><code>cp filename.php destination_directory\/<\/code><\/pre><ul>\n<li>\n<p class=\"no-margin\">Copy the whole <b>folder <\/b>and <b>rename <\/b>it:<\/p>\n<\/li>\n<\/ul><pre><code>cp -R foldername\/ newfoldername\/<\/code><\/pre><ul>\n<li>\n<p class=\"no-margin\">Copy the files to <b>another directory<\/b> and <b>replace <\/b>the existing ones:<\/p>\n<\/li>\n<\/ul><pre><code>cp -f filename.php destination_directory\/<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">That&rsquo;s it! Now you know how to copy files and folders using <b>SSH<\/b> &#128522; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Copying files and folders using SSH<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[235],"tags":[],"class_list":["post-1140","post","type-post","status-publish","format-standard","hentry","category-ssh-connection-and-ssh-keys"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/4725353-how-to-copy-files-or-folders-using-ssh-at-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/4725353-como-copiar-archivos-o-carpetas-usando-ssh-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/4725353-comment-copier-des-fichiers-ou-des-dossiers-en-utilisant-ssh-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/4725353-bagaimana-cara-menyalin-file-atau-folder-menggunakan-ssh-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/4725353-como-copiar-arquivos-ou-pastas-usando-ssh-no-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/4725353-------\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1140"}],"version-history":[{"count":1,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1140\/revisions"}],"predecessor-version":[{"id":4518,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1140\/revisions\/4518"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}