{"id":21821,"date":"2023-10-01T03:28:37","date_gmt":"2023-10-01T03:28:37","guid":{"rendered":"https:\/\/linuxways.net\/?p=21821"},"modified":"2023-10-01T03:28:37","modified_gmt":"2023-10-01T03:28:37","slug":"how-to-copy-an-entire-folder-in-linux-ubuntu","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-copy-an-entire-folder-in-linux-ubuntu\/","title":{"rendered":"How to Copy an Entire Folder in Linux\/Ubuntu?"},"content":{"rendered":"<p>Copying files and folders is one of the essential and most frequent tasks we do every day while working on organizing data, creating backups, sharing files, editing, etc. In Linux distributions including Ubuntu, this task can be accomplished via the <strong>command line<\/strong> tools as well as <strong>GUI (Graphic User Interface)<\/strong>. In this article, we will demonstrate different methods to copy single and multiple folders\/directories in Linux\/Ubuntu 22.04 LTS.<\/p>\n<h2><a id=\"post-21821-_ljks07h0rocp\"><\/a>Prerequisites<\/h2>\n<p>In order to follow this article, we will require<\/p>\n<ul>\n<li>System with Ubuntu 22.04 LTS Installed.<\/li>\n<li>Basic knowledge of command line usage.<\/li>\n<\/ul>\n<h2><a id=\"post-21821-_vwi4ezl9toa3\"><\/a>How to Copy an Entire Folder in Linux\/Ubuntu?<\/h2>\n<p>An entire folder is copied in Linux\/Ubuntu 22.04 using the following methods:<\/p>\n<ul>\n<li>Method 1: Via Command Line<\/li>\n<li>Method 2: Via Ubuntu\u2019s Desktop File Manager<\/li>\n<\/ul>\n<h2><a id=\"post-21821-_bxx8w22b1byi\"><\/a>Method 1: Copy a Folder\/Directory via the Command Line<\/h2>\n<p>In this section, we will demonstrate two popular command line tools: <strong>cp<\/strong> and <strong>rsync<\/strong> to copy a folder.<\/p>\n<h2><a id=\"post-21821-_vwieklbk4w8v\"><\/a>How to Copy a Folder\/Directory via the \u201ccp\u201d Command?<\/h2>\n<p>\u201c<strong>cp<\/strong>\u201d is one of the most commonly used command line tools. cp copies single or multiple folders\/directories from a source directory to a destination directory.<\/p>\n<h3><\/h3>\n<h3><a id=\"post-21821-_pki51tyr6l40\"><\/a>How to Copy a Single Folder\/Directory via the \u201ccp\u201d Command?<\/h3>\n<p>The basic syntax to copy a single directory using the \u201ccp\u201d command is:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">cp<\/span> <span class=\"re5\">-r<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path<span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>destination-directory-path<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>In the above syntax, \u201ccp\u201d is the main keyword followed by the \u201c-r\u201d flag, which denotes \u201crecursive\u201d. The \u201cr\u201d flag copies all source directory files to the destination path.<\/p>\n<p>Consider a scenario of moving a folder named \u201cFiles\u201d from the \u201cHome\u201d folder to the \u201cDocuments\u201d folder. We can navigate to the \u201cHome\u201d folder and check the contents of the \u201cHome\u201d folder as below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">ls<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1658\" height=\"144\" class=\"wp-image-21822\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-1.png 1658w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-1-300x26.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-1-1024x89.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-1-768x67.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-1-1536x133.png 1536w\" sizes=\"auto, (max-width: 1658px) 100vw, 1658px\" \/><\/p>\n<p>Further, the contents of the \u201cFiles\u201d folder can be seen by executing the following code:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">ls<\/span> <span class=\"re5\">-l<\/span> Files<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1774\" height=\"354\" class=\"wp-image-21823\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-2.png 1774w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-2-300x60.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-2-1024x204.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-2-768x153.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-2-1536x307.png 1536w\" sizes=\"auto, (max-width: 1774px) 100vw, 1774px\" \/><\/p>\n<p>We can copy a single folder \u201cFiles\u201d along with all its contents from the \u201cHome\u201d directory to the \u201cDocuments\u201d directory along with renaming the copied file to \u201cMovedFiles\u201d by running the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">cp<\/span> <span class=\"re5\">-r<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Files <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Documents<span class=\"sy0\">\/<\/span>MovedFiles<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1562\" height=\"84\" class=\"wp-image-21824\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-3.png 1562w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-3-300x16.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-3-1024x55.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-3-768x41.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-3-1536x83.png 1536w\" sizes=\"auto, (max-width: 1562px) 100vw, 1562px\" \/><\/p>\n<p>We can verify that the folder \u201cMovedFiles\u201d is copied by navigating to the \u201cDocuments\u201d folder via the cd command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Downloads<br \/>\n<br \/>\n$ <span class=\"kw2\">ls<\/span><\/div><\/div>\n<p>From the below image, it can be observed that the folder \u201cMovedFiles\u201d is copied.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1890\" height=\"224\" class=\"wp-image-21825\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-4.png 1890w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-4-300x36.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-4-1024x121.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-4-768x91.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-4-1536x182.png 1536w\" sizes=\"auto, (max-width: 1890px) 100vw, 1890px\" \/><\/p>\n<p>We can also verify the contents of the folder as follows:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">ls<\/span> <span class=\"re5\">-l<\/span> MovedFiles<\/div><\/div>\n<p>The below image verifies that all contents of the folder are successfully copied:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"400\" class=\"wp-image-21826\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-5.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-5-300x59.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-5-1024x200.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-5-768x150.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-5-1536x300.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<h3><strong>How to Copy Multiple Folders Using cp Command?<\/strong><\/h3>\n<p>We can copy multiple folders simultaneously with the \u201ccp\u201d command as well. The basic syntax to copy multiple folders using the \u201ccp\u201d command is:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">cp<\/span> <span class=\"re5\">-r<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path-<span class=\"nu0\">1<\/span><span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path-<span class=\"nu0\">2<\/span><span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path-<span class=\"nu0\">3<\/span><span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>destination-directory-path<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>Consider the scenario of moving \u201cFiles1\u201d, \u201cFiles2\u201d, and \u201cFiles3\u201d from the \u201cHome\u201d directory to a Directory named \u201cExtra\u201d in the \u201cDocuments\u201d directory. We can check the contents of the Home directory by executing the below command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">ls<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"211\" class=\"wp-image-21827\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-6.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-6-300x31.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-6-1024x106.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-6-768x79.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-6-1536x158.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p>In the following code block, first, we use the cd command to access the \u201cDocuments\u201d directory. Then, we create a directory \u201cExtra\u201d in that directory using the mkdir command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Documents<br \/>\n<br \/>\n$ <span class=\"kw2\">mkdir<\/span> Extra<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"365\" class=\"wp-image-21829\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-7.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-7-300x53.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-7-1024x183.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-7-768x137.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-7-1536x274.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p>We can copy multiple files, i.e., \u201cFiles1\u201d, \u201cFiles2\u201d, and \u201cFiles3\u201d along with all their contents from the \u201cHome\u201d directory to the \u201cDocuments\u201d directory by running the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">cp<\/span> <span class=\"re5\">-r<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Files1 <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Files2 <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Files3 <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Documents<span class=\"sy0\">\/<\/span>Extra<\/div><\/div>\n<p>The cursor moves to the new line indicating that the cp command is executed successfully:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"156\" class=\"wp-image-21830\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-8.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-8-300x23.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-8-1024x78.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-8-768x59.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-8-1536x117.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p>We can verify that the files are copied by navigating to the \u201cExtra\u201d folder via the cd command and then executing the \u201cls -l\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Documents<br \/>\n<br \/>\n$ <span class=\"kw2\">ls<\/span> <span class=\"re5\">-l<\/span> Extra<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"374\" class=\"wp-image-21831\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-9.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-9-300x55.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-9-1024x187.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-9-768x140.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-9-1536x281.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p>From the above image, it can be seen that all the File1, File2, and File3 are successfully copied into the Extra folder.<\/p>\n<h3><a id=\"post-21821-_cuw9lhk7bld3\"><\/a>How to Copy a Folder\/Directory via the \u201crsync\u201d Command?<\/h3>\n<p>\u201c<strong>Rsync<\/strong>\u201d is a command line utility that copies single or multiple directories from the source to the destination directory.<\/p>\n<h3><a id=\"post-21821-_cndtavjaflui\"><\/a>How to Copy a Single Folder\/Directory via rsync Command?<\/h3>\n<p>The basic syntax to copy a single folder via the \u201crsync\u201d command is:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span>rsync <span class=\"re5\">-a<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path<span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>destination-directory-path<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>In the above syntax, \u201crsync\u201d is the main keyword followed by the \u201c-a\u201d flag, which transfers\/copies all source directory files to the destination directory.<\/p>\n<p>Consider a scenario of moving a folder named \u201cExtra\u201d from the \u201cDocuments\u201d folder to the \u201cDownloads\u201d folder. We can navigate to the \u201cExtra\u201d folder and check the contents as follows:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Documents<br \/>\n<br \/>\n$ <span class=\"kw2\">ls<\/span> <span class=\"re5\">-l<\/span> Extra<\/div><\/div>\n<p>As seen from the below image, the Extra folder contains three files, File1, File2, and File3.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"511\" class=\"wp-image-21832\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-10.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-10-300x75.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-10-1024x256.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-10-768x192.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-10-1536x383.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p>We can copy a single folder \u201cFiles\u201d along with all its contents from the \u201cExtra\u201d directory to the \u201cDownloads\u201d directory by running the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span>rsync <span class=\"re5\">-a<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Documents<span class=\"sy0\">\/<\/span>Extra <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Downloads<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"181\" class=\"wp-image-21833\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-11.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-11-300x27.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-11-1024x91.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-11-768x68.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-11-1536x136.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p>We can verify that the file is copied by navigating to the \u201cDownloads\u201d folder via the cd command and checking the contents of the Extra directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Downloads<br \/>\n<br \/>\n$ <span class=\"kw2\">ls<\/span> <span class=\"re5\">-l<\/span> Extra<\/div><\/div>\n<p>From the below image, we can see that the folder \u201cExtra\u201d is copied along with all its contents.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"650\" class=\"wp-image-21834\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-12.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-12-300x95.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-12-1024x325.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-12-768x244.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-12-1536x488.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p><strong>How to Copy Multiple Folders Using rsync Command?<\/strong><\/p>\n<p>We can copy multiple folders simultaneously with the rsync command as well. The basic syntax to copy multiple folders using the rsync command is:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span>rsync <span class=\"re5\">-a<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path-<span class=\"nu0\">1<\/span><span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path-<span class=\"nu0\">2<\/span><span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>source-directory-path-<span class=\"nu0\">3<\/span><span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>destination-directory-path<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>Consider the scenario of moving \u201cFiles1\u201d, \u201cFiles2\u201d, and \u201cFiles3\u201d in the \u201cExtra\u201d directory to a Directory \u201crsync\u201d in the \u201cDocuments\u201d directory. We can check the contents of the Extra directory by navigating to the Extra directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Downloads<br \/>\n<br \/>\n$ <span class=\"kw2\">ls<\/span> <span class=\"re5\">-l<\/span> Extra<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"633\" class=\"wp-image-21835\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-13.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-13-300x93.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-13-1024x317.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-13-768x237.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-13-1536x475.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<p>We can copy multiple files, i.e., \u201cFiles1\u201d, \u201cFiles2\u201d, and \u201cFiles3\u201d along with all their contents from the \u201cExtra\u201d directory to the \u201crsync\u201d directory by running the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span>rsync <span class=\"re5\">-a<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Downloads<span class=\"sy0\">\/<\/span>Extra<span class=\"sy0\">\/<\/span>Files1 <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Downloads<span class=\"sy0\">\/<\/span>Extra<span class=\"sy0\">\/<\/span>Files2 <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Downloads<span class=\"sy0\">\/<\/span>Extra<span class=\"sy0\">\/<\/span>Files3 <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxuser<span class=\"sy0\">\/<\/span>Documents<span class=\"sy0\">\/<\/span>rsync<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1110\" height=\"117\" class=\"wp-image-21836\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-14.png 1110w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-14-300x32.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-14-1024x108.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-14-768x81.png 768w\" sizes=\"auto, (max-width: 1110px) 100vw, 1110px\" \/><\/p>\n<p>We can verify that the files are copied by navigating to the \u201crsync\u201d folder via the cd command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Documents<span class=\"sy0\">\/<\/span>rsync<br \/>\n<br \/>\n$ <span class=\"kw2\">ls<\/span> <span class=\"re5\">-l<\/span><\/div><\/div>\n<p>From the below image, it can be seen that File1, File2, and File3 are successfully copied into the rsync folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"397\" class=\"wp-image-21837\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-15.png 2048w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-15-300x58.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-15-1024x199.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-15-768x149.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-15-1536x298.png 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<h2><a id=\"post-21821-_qhjt1dpe89je\"><\/a>Method 2: Copy a Folder\/Directory Via Ubuntu\u2019s Desktop File Manager<\/h2>\n<p>In this section, we will demonstrate how to copy a single folder and multiple folders with ease using Ubuntu 22.04 LTS Desktop File Manager.<\/p>\n<h2><a id=\"post-21821-_g4g5nyxkohsf\"><\/a>How to Copy Single Folder\/Directory Using Ubuntu\u2019s Desktop File Manager?<\/h2>\n<p>Consider a scenario of copying a folder \u201cFiles\u201d in the Home Folder to the \u201cDocuments\u201d folder. We can accomplish it by the steps mentioned below:<\/p>\n<h3><a id=\"post-21821-_9m45qn5jqjfv\"><\/a>Step 1: Select a Folder\/Directory<\/h3>\n<p>We will navigate to the location where the desired folder exists, i.e., the \u201cHome\u201d folder:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1818\" height=\"690\" class=\"wp-image-21838\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-16.png 1818w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-16-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-16-1024x389.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-16-768x291.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-16-1536x583.png 1536w\" sizes=\"auto, (max-width: 1818px) 100vw, 1818px\" \/><\/p>\n<p>After that, select the desired folder \u201cFiles\u201d and press \u201cright-click\u201d by utilizing the mouse. It will generate a drop-down menu list. From the drop-down menu list, we will select the \u201cCopy\u201d option as shown below:<\/p>\n<h2><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1820\" height=\"690\" class=\"wp-image-21839\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-17.png 1820w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-17-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-17-1024x388.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-17-768x291.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-17-1536x582.png 1536w\" sizes=\"auto, (max-width: 1820px) 100vw, 1820px\" \/><\/p>\n<p>In the above image, a Folder named \u201cFiles\u201d in the Home directory is copied.<\/p>\n<h3><a id=\"post-21821-_o36z0os9upuc\"><\/a>Step 2: Copy the Folder\/Directory at Desired Folder\/Directory<\/h3>\n<p>We will then navigate to the desired directory, i.e., the \u201cDocuments\u201d where we would like to copy the folder. A folder can be copied by pressing the \u201cright-click\u201d of the mouse. It will generate a drop-down menu list. From the drop-down menu list, we will select the \u201cPaste\u201d option as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1822\" height=\"692\" class=\"wp-image-21840\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-18.png 1822w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-18-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-18-1024x389.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-18-768x292.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-18-1536x583.png 1536w\" sizes=\"auto, (max-width: 1822px) 100vw, 1822px\" \/><\/p>\n<p>The desired folder named \u201cFiles\u201d will be copied from \u201cHome\u201d to the \u201cDocuments\u201d folder as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1818\" height=\"692\" class=\"wp-image-21841\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-19.png 1818w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-19-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-19-1024x390.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-19-768x292.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-19-1536x585.png 1536w\" sizes=\"auto, (max-width: 1818px) 100vw, 1818px\" \/><\/p>\n<p>Similarly, we can copy multiple folders by following the above steps.<\/p>\n<h2><a id=\"post-21821-_xi897mpdmeg5\"><\/a>How to Copy Multiple Folders\/Directories Using Ubuntu\u2019s Desktop File Manager?<\/h2>\n<p>Consider a scenario of copying folders \u201dFiles1\u201d, \u201cFiles2\u201d, and \u201cFiles3\u201d in the \u201cExtra\u201d Folder to the \u201cDownloads\u201d folder. We can accomplish it by the steps mentioned below:<\/p>\n<h3><a id=\"post-21821-_fldiilgogjhs\"><\/a>Step1: Select Folders\/Directories<\/h3>\n<p>We will navigate to the location where the desired folder exists, i.e., in the \u201cExtra\u201d, and will select multiple folders and press the \u201cright-click\u201d of the mouse. It will generate a drop-down menu list. From the drop-down menu list, we will select the \u201cCopy\u201d option as shown below<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1822\" height=\"688\" class=\"wp-image-21842\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-20.png 1822w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-20-300x113.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-20-1024x387.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-20-768x290.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-20-1536x580.png 1536w\" sizes=\"auto, (max-width: 1822px) 100vw, 1822px\" \/><\/p>\n<p>In the above image, Folders: \u201cFiles1\u201d, \u201cFiles2\u201d, and \u201cFiles3\u201d in the Extra directory are copied.<\/p>\n<h3><a id=\"post-21821-_it6536bqhv6o\"><\/a>Step 2: Copy the Folders\/Directories to the <strong>Desired Directory<\/strong><\/h3>\n<p>We will then navigate to the desired directory, i.e., the \u201cDownloads\u201d directory, where we would like to copy the folders. The folders can be copied by pressing the \u201cright-click\u201d of the mouse. It will generate a drop-down menu list. From the drop-down menu list, we will select the \u201cPaste\u201d option as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1820\" height=\"688\" class=\"wp-image-21843\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-21.png 1820w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-21-300x113.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-21-1024x387.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-21-768x290.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-21-1536x581.png 1536w\" sizes=\"auto, (max-width: 1820px) 100vw, 1820px\" \/><\/p>\n<p>The desired folders: \u201cFiles1\u201d, \u201cFiles2\u201d, and \u201cFiles3\u201d will be copied from the \u201cExtra\u201d to the \u201cDownloads\u201d folder as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1820\" height=\"686\" class=\"wp-image-21844\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-22.png 1820w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-22-300x113.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-22-1024x386.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-22-768x289.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-21821-22-1536x579.png 1536w\" sizes=\"auto, (max-width: 1820px) 100vw, 1820px\" \/><\/p>\n<h2><a id=\"post-21821-_k4r3ojha6hv3\"><\/a>Conclusion<\/h2>\n<p>Single and multiple folders can be copied in the command line by using \u201ccp\u201d and \u201crsync\u201d command line tools while files can be copied with ease using \u201cCopy\u201d and \u201cPaste\u201d using Ubuntu\u2019s Desktop File Manager. In this article, we discussed different ways of copying single and multiple folders in Linux\/Ubuntu 22.04 LTS.<\/p>","protected":false},"excerpt":{"rendered":"<p>Single and multiple folders can be copied in the command line using the \u201ccp\u201d and \u201crsync\u201d commands, while in GUI, files can be copied using \u201cCopy\u201d and \u201cPaste\u201d. <\/p>","protected":false},"author":110,"featured_media":21828,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1049,2],"tags":[],"class_list":["post-21821","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-commands","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/21821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=21821"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/21821\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/21828"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=21821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=21821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=21821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}