Find the answer to your Linux question:
Results 1 to 2 of 2
Hello everybody ! I'm currently writing a backup script which uses the rsync command. I have to backup the entire directory structure and certain types of files. So, my rsync ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2012
    Posts
    1

    Question rsync : how to exclude hidden files and directories ?


    Hello everybody !

    I'm currently writing a backup script which uses the rsync command. I have to backup the entire directory structure and certain types of files. So, my rsync command looks like this :

    Code:
    rsync -azd --include='*/' --include='*.nk' --include='*.sni' --include='*.nk.autosave' --exclude='*' --stats /source_folder/* /backup_folder
    In some directories of my source folder, i have hidden files and directories (like ".AppleDouble/", ".DS_Store", ...). I don't want to backup this type of files/directories and anyway, the rsync command returns me errors when it tries to backup them (It's because on the partition of my backup_folder, i cannot create files or directories whose name starts by a dot).

    So, do you know the correct regex to exclude hidden files and directories from my rsync command ?

    Thank you in advance !

  2. #2
    Just Joined! bonesTdog's Avatar
    Join Date
    Jan 2011
    Location
    Atlanta, GA
    Posts
    91
    Just a guess here... --exclude=PATTERN? Try this Slicehost Articles: rsync - exclude files and folders

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •