Link to home
Start Free TrialLog in
Avatar of gaurav sharma
gaurav sharma

asked on

Rsync to list files that did not get copied to destination directory

rsync -avzh path/to/directory/A/ path/to/directory/B

The above commands copies everything under directory A to directory B. Sometimes during the copy the files in destination B are locked by some other process which makes the copy incomplete. Is there a way in Rsync to list all such locked files that did not get copied over to the destination.
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Add "--dry-run" to the options of your command.

rsync will tell you which files are still to be copied without actually transferring anything.
Avatar of gaurav sharma
gaurav sharma

ASKER

Dry run gives me the list of all the objects that get copied to the destination.
I only need the list of files that are not transferred from source.
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try adding a log file and check that you've run the rsync command:

--log-file=FILE
Gaurav.. but i would suggest doing the rsync on open files won't be done.. i tried it numerous times but always it has a need of downtime to get the migration done.

I would suggest take the downtime with app owner and do the rsync, else open or locked files will always be acting like this only.

Ty/SA
Thank you for all the comments. I have a folder of size 4 gb that needs to be copied to a location. It should overwrite everything each time on the destination. The copy fails many a times since the files in the destination are locked. I need something that would tell me which files could not be copied due to that encountered lock.
The copy can be done using cygwin or windows.
Consult the logfile, I keep telling you.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial