LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-13-2006, 09:45 AM   #1
edwin11
Member
 
Registered: Dec 2005
Distribution: Linux Mint 13 MATE
Posts: 120

Rep: Reputation: 15
rsync - How to Include Hidden (.something) Files and Directories?


Hi guys,

i'm using a script to do regular backups, and i just realized that my hidden files and directories (.something) weren't getting backed up.

My rsync command is:

Code:
rsync -va --delete /home/me/* /mnt/backuphdd/home
i've looked at the man pages for rsync, but it seems that none of the options deal with hidden files specifically.

Any advice on how i can include those hidden files and directories?



TIA and Regards,
Edwin
 
Old 11-13-2006, 11:17 AM   #2
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
You could try adding
Code:
--include ".*"
 
Old 11-13-2006, 11:53 AM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,283

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by edwin11
My rsync command is:
Code:
rsync -va --delete /home/me/* /mnt/backuphdd/home
Change your command to this:
Code:
rsync -va --delete /home/me/ /mnt/backuphdd/home/
Look closely for changes in the command. Specifically, trailing slashes on both the source and destination paths, and lack of the * character.

The rsync manpages cover the differences in trailing slashes vs. no trailing slashes, but I have to admit I reread that section a time or two before I understood (and could predict) what would happen if I put those slashes there or left them out. Easiest way to learn the subtlties might be to just create some test source directories and files - some hidden, some not - and try different variations of rsync options then observe what you get.
 
Old 11-29-2006, 08:30 AM   #4
edwin11
Member
 
Registered: Dec 2005
Distribution: Linux Mint 13 MATE
Posts: 120

Original Poster
Rep: Reputation: 15
Thanks haertig, i did as you said, and it now works as intended!

i have also re-read the man pages for rsync...

The use of trailing slashes in the source directory now seems clear enough, e.g. if i have the following directories

Code:
/src
/src/a
/src/a/b
/src/c
/src/.d
/dest
Code:
/src/a -> /dest
would copy the directory "a" wholesale to "dest", giving us
Code:
/src/a
/src/a/b
Code:
/src/a/ -> /dest
would copy the contents of "a" to "dest", giving us
Code:
/dest/b
Code:
/src/* -> /dest
would copy the files and directories matching "*" to "dest", giving us
Code:
/src/a
/src/a/b
/src/c
Code:
/src/ -> /dest
would copy the contents of "src" to "dest", giving us
Code:
/dest/a
/dest/a/b
/dest/c
/dest/.d

Hence

1. it seems that
Code:
/src/* -> /dest
and
Code:
/src/ -> /dest
differs only in whether hidden files and directories gets copied or not?

2. whether or not there is a trailing slash in the destination location doesn't have an impact?


Or am i wildly off the mark here?



Thanks and Regards,
Edwin
 
Old 11-29-2006, 08:47 AM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
If your script is using bash, put this in it before the rsync command. If you're running from the command line, just type it in before callling rsync:
Code:
shopt -s dotglob
See this post for a longer explanation.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync --include-file Help Needed steelheadwook Linux - Software 4 06-14-2006 01:53 PM
hidden directories Alwyn Linux - Newbie 1 07-19-2005 07:24 AM
RSYNC and include?? JediKnight2 Linux - Software 0 02-04-2005 12:52 PM
how to rsync ex/include select specific directories ? dtimms Linux - Software 1 01-11-2005 06:16 AM
Copying Hidden Directories Guru3 Linux - General 1 12-05-2003 01:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration