Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8097901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:54:28+00:00 2026-06-05T21:54:28+00:00

How can I rsync mirror only *.php files? This gives me a bunch of

  • 0

How can I rsync mirror only *.php files? This gives me a bunch of empty dirs too and I don’t want those.

rsync -v -aze 'ssh ' \
--numeric-ids \
--delete \
--include '*/' \
--exclude '*' \
--include '*.php' \
user@site.com:/home/www/domain.com \
/Volumes/Servers/
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:54:30+00:00Added an answer on June 5, 2026 at 9:54 pm

    The culprit here is the

    --include '*/'  
    

    When including a wildcard followed by the trailing forward-slash you’re telling rsync to transfer all files ending with a ‘/’ (that is, all directories).
    Thus,

    rsync -v -aze 'ssh ' \
    --numeric-ids \
    --delete \
    --exclude '*' \
    --include '*.php' \
    user@site.com:/home/www/domain.com \
    /Volumes/Servers/
    

    If you were using that because you intend to recursively find all .php files, you’d have to use the ** wildcard.
    That is,
    --include '**/*.php'

    Another way ( http://www.commandlinefu.com/commands/view/1481/rsync-find ) is pre-finding the target files and then using rsync,

    find source -name "*.php" -print0 | rsync -av --files-from=- --from0 ./ ./destination/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can rsync be done with a date filter, such that only files newer than
The Rsync -u flag prevents the overwriting of modified destination files. How can I
Using rsync, how can I rename files when copying with the --files-from argument? I
How can I sync local and remote folders using rsync from inside a php
I want to set up an automatic rsync job to backup a bunch of
I want to put command option of rsync into a variable so I can
Can anyone help - this is driving me mad. I am calling a mysql
Can someone please tell me what this means: 07-04 09:54:38.048: I/DetailActivity(15496): Title that is
Can anybody please tell me why the removeEventListener call is not working? this.addEventListener(Event.ENTER_FRAME, eventCall,
I am attempting to mirror a directory on a remote server using rsync. However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.