Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

rsync issue

  • 08-07-2011 08:55PM
    #1
    Registered Users, Registered Users 2 Posts: 3,692
    ✭✭✭


    I'm using rsync to copy files from a folder on my PC to an External Hard drive.
    I don't want to copy all the folders within the source folder so am using --exclude-from to exclude the sub-folders I don't want copied thus my command looks like this:
    rsync -avz /path_to_source_directory/  /path_to_target_directory/ --exclude-from list.txt
    
    where list.txt is a simple listing of the sub-folders I want rsync to ignore.

    However rysnc does ignore some of the sub-folders but not all. It continues to copy about half the folders across.
    Can anyone help figure out why this is happening?


Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Registered Users, Registered Users 2 Posts: 14,084 Johnboy1951
    ✭✭✭✭


    Only reason I can think of is that some of the paths are not complete or are somehow incorrect ....


  • Registered Users, Registered Users 2 Posts: 3,692 DeepBlue
    ✭✭✭


    I use the following to pipe out the directory list (and then manually delete from the list the folders I want to copy.)
    find . -maxdepth 1 -mindepth 1 -type d -printf %P\\n | sort -d >list.txt
    
    It shouldn't treat some folder names in a different fashion to others yet for some folders rsync recognises the pattern and excludes them and for others it doesn't. :confused:


  • Registered Users, Registered Users 2 Posts: 3,692 DeepBlue
    ✭✭✭


    Ok, slightly solved.

    The only difference between the sub-folders that weren't ignored as they should have been and the ones that were correctly ignored is that the ones that weren't ignored had a square bracket '' in the folder name. i.e. Holiday Photos [2007]
    For some reason this throws off the pattern matching. Once those were removed all the sub-folders were ignored correctly.

    Ideally I'd prefer not to have to rename the files so will continue looking for a solution rather than a workaround.


  • Registered Users, Registered Users 2 Posts: 14,084 Johnboy1951
    ✭✭✭✭


    I guess you could try quoting the filenames in the list or maybe the -s option would work ..... that was for spaces in names but it may work I suppose for the brackets ....


  • Registered Users, Registered Users 2 Posts: 3,692 DeepBlue
    ✭✭✭


    OSI wrote: »
    Did you remember to escape special characters?
    No, I didn't realise that '[' has a special meaning for rsync.

    I imagine that replacing the '[' with a '?' may allow rsync to copy the file.


  • Advertisement
  • Closed Accounts Posts: 18,966 syklops
    ✭✭✭✭


    DeepBlue wrote: »
    No, I didn't realise that '[' has a special meaning for rsync.

    I imagine that replacing the '

    No, just 'escape it' by putting a \ in front of it.


  • Registered Users, Registered Users 2 Posts: 3,692 DeepBlue
    ✭✭✭


    syklops wrote: »
    No, just 'escape it' by putting a \ in front of it.
    From brief testing both methods work. It's good to have choice. :D


Welcome!

It looks like you're new here. Sign in or register to get started.
Advertisement