Advertisement
thioshp

Bash Copy a Directory. using RSYNC

Sep 5th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. # Copy a dir X recursively into destination/X
  2.  
  3. # This helps to recreate the SRCDIR (plus all its files and/or subfolders) inside DESTDIR/SRCDIR (plus all its files and/or subfolders)
  4.  
  5. # Use the following alias cpdir that uses rsync as follows:
  6.  
  7. alias cpdir='rsync -iruv --ignore-existing'
  8.  
  9. # Copy a folder as follows
  10.  
  11. cpdir /path/to/SRCDIR /path/to/DESTDIR/
  12.  
  13. # NOTE:
  14.  
  15. 1. Do NOT include the trailing backslash of /path/to/SRCDIR
  16.  
  17. 2. DESTDIR must include a backslash i.e /path/to/DESTDIR/
  18.  
  19. # EXAMPLE
  20. - To recreate dir assist (from sdcard/assist) within ~/tmp, do
  21.  
  22. cpdir /sdcard/assist ~/tmp/
  23.  
  24. - Note that /sdcard/assist has NO "/" BUT ~/tmp/ does!!
  25.  
  26. - ~/tmp will now become ~/tmp/assist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement