$ cd ostechnix/Īnd, run the following command: $ cp -r `ls -A | grep -v "dir2"` /home/sk/backup/ Go your source directory i.e ostechnix in our case. We can also use cp command to copy folders from one location to another excluding specific directories. How to find the size of a directory in Linux from command line.How To Quickly Transfer Large Files Over Network In Linux And Unix.It is actually a good idea to omit or exclude some big or less important directories from copying while backup your system using rsync in order to save your time.įor more details, check man pages. $ rsync -av -progress -exclude="folder_to_exclude" source_dirctory dest_directoryĮxample: $ rsync -av -progress -exclude="dir2" ostechnix/ backup/ The above command will copy all contents of the folder ostechnix to a folder namely backup, and it will exclude the directory dir2 from copying.Īlternatively, you can use the same command as below. To exclude a specific directory from copying using rsync command, just run: $ rsync -av -progress ostechnix/ backup/ -exclude dir2 You want to copy dir1 and dir3 to different location, but not dir2. Inside the directory ostechnix, there are three sub-directories namely dir1, dir2, and dir3. Let us say you have a folder called ostechnix. Using exclude option, we can exclude certain files/directories from copying. As you may already know, Rsync is a fast and versatile tool to copy files and folders locally, or to/from another host over any remote shell, or to/from a remote rsync daemon.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |