LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-28-2021, 07:31 PM   #1
salilsurendran
LQ Newbie
 
Registered: May 2015
Posts: 16

Rep: Reputation: Disabled
rsync created a bunch of empty directories even though I specifically only transferred


I used this command on my mac terminal to only to sync only java files whose size had changed on the remote host:

rsync -rP --size-only --include="/" --include=".java" --exclude="*" /src/dir1/ remote-host:/src/dir1/

However, there were several .git/objects/??/ directories in my source folder but it had no java files in it.

for eg.

ls .git/objects/e3 4704650cf08c9d36c8e6699cf08b6e672e532b <= file but not java

On the remote host it created the exact same .git/objects/e3 folder but completely empty. How do I prevent this?
 
Old 04-28-2021, 09:11 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 21,491

Rep: Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106Reputation: 4106
You can always use --dry-run or -vvv to maybe get a better picture of how your options work.

As I understand rsync and the options as posted.

--include="/" will only include the root directory but not sub-directories regardless of the -r option. Since sub-directories are being created I assume this is a typo?

--include=".java" will only include a file called .java but I assume you actually want --include="*.java"

If you use --include="*/" rsync will include all subdirectories and create them on the destination but since your only including ".java" those directories are empty.

If you use the -m option then empty destination sub-directories will not be created.

Remember that options use a relative path to the source directory.
 
Old 04-29-2021, 01:29 PM   #3
salilsurendran
LQ Newbie
 
Registered: May 2015
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
You can always use --dry-run or -vvv to maybe get a better picture of how your options work.

As I understand rsync and the options as posted.

--include="/" will only include the root directory but not sub-directories regardless of the -r option. Since sub-directories are being created I assume this is a typo?

--include=".java" will only include a file called .java but I assume you actually want --include="*.java"

If you use --include="*/" rsync will include all subdirectories and create them on the destination but since your only including ".java" those directories are empty.

If you use the -m option then empty destination sub-directories will not be created.

Remember that options use a relative path to the source directory.
Thanks -m option worked very well.
 
  


Reply

Tags
mac, rsync, terminal


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wolfssh returns error code 1 even the file has been transferred to the server successfully jy824212 Linux - Newbie 2 08-15-2020 07:32 AM
Filesystem Empty Even Though LV Shows Used Space? anon3001 Linux - Newbie 7 02-07-2018 09:05 AM
Folders on my harddrive appear empty even though they shouldn't be. hamslam9000 Puppy 9 05-16-2017 09:31 AM
[SOLVED] XfBurn says 'Drive empty' even though it isn't - Linux Mint 17.2 Delusion of Adequacy Linux - Hardware 6 03-06-2016 08:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:59 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
Open Source Consulting | Domain Registration