Jump to content

Robocopy, for Linux

Hey guys. I have this batch script for windows that will sync a few network shared folders to my usb drive. I use robocopy /mir for the script.

 

Is there an equivalent command to do it in Linux?

I came across Rysnc but from what i checked and tried, it doesn't support Samba and it couldn't retain the attribute of the original files copied from Windows filesystem.

| Intel i7-3770@4.2Ghz | Asus Z77-V | Zotac 980 Ti Amp! Omega | DDR3 1800mhz 4GB x4 | 300GB Intel DC S3500 SSD | 512GB Plextor M5 Pro | 2x 1TB WD Blue HDD |
 | Enermax NAXN82+ 650W 80Plus Bronze | Fiio E07K | Grado SR80i | Cooler Master XB HAF EVO | Logitech G27 | Logitech G600 | CM Storm Quickfire TK | DualShock 4 |

Link to comment
Share on other sites

Link to post
Share on other sites

52 minutes ago, xAcid9 said:

I came across Rysnc but from what i checked and tried, it doesn't support Samba and it couldn't retain the attribute of the original files copied from Windows filesystem.

Mount the Samba share. Then you can treat it like a local directory, no need for rsync to worry about that.

 

To preserve permissions and attributes you should use --archive (-a), not sure if this works with Windows attributes though.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks.

Local smb mount workaround works but rsync can't copy file attributes(hidden, read-only) from NTFS even with --xattrs(-X).

Similar experience with cp

| Intel i7-3770@4.2Ghz | Asus Z77-V | Zotac 980 Ti Amp! Omega | DDR3 1800mhz 4GB x4 | 300GB Intel DC S3500 SSD | 512GB Plextor M5 Pro | 2x 1TB WD Blue HDD |
 | Enermax NAXN82+ 650W 80Plus Bronze | Fiio E07K | Grado SR80i | Cooler Master XB HAF EVO | Logitech G27 | Logitech G600 | CM Storm Quickfire TK | DualShock 4 |

Link to comment
Share on other sites

Link to post
Share on other sites

58 minutes ago, xAcid9 said:

Local smb mount workaround works but rsync can't copy file attributes(hidden, read-only) from NTFS even with --xattrs(-X).

This is an issue with carrying permissions over to a different filesystem rather than with rsync or cp specifically. More information here

 

You could try working around this limitation with some clever scripting using the ntfs-3g.secaudit utility - you'd need to read all file and folder permissions recursively from the source and save them somewhere for reference, use rsync, then reapply the same permissions to the target folder tree. If you're copying to a different filesystem you could define and apply the closest equivalent.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×