Is there equivalent of "xcopy /t /e" in Zorin OS script programs?

I'm thinking of switching to Zorin OS
I used UNIX until 1987 but MSDOS and Windows since then
Each year I make a new empty folder structure by typing "xcopy year_one*.* year_two /t /e"
I also have other several batch files using xcopy that will need to be rewritten as scripts

The Linux equivalent would use rsync or find with cpio. A direct replacement using rsync looks like:

rsync -a -f"+ */" -f"- *" year_one/ year_two/

The -a is archive mode which preserves permissions, symlinks, etc.
-f"+ */"will include directories
-f"- *" will exclude all files
year_one/: source directory
year_two/: destination

You can keep and run it as a Shell Script which you would save with the .sh extension (e.g. xcopyredux.sh)

#!/bin/bash
rsync -a -f"+ */" -f"- *" "$1/" "$2/"
2 Likes

Hi, and welcome to Zorin OS :slight_smile:

If you can tell us more about your folder structure we can try to help with the scripting part.

Or, if you prefer to learn how to do this on your own, I can recommend this playlist on YouTube to get a good general idea of what tools are available, how they work, etc:

https://www.youtube.com/playlist?list=PLy7Kah3WzqrHPrgkBgwzXyfDDCvthdUfl

In any case, feel free to ask if you have any questions about it.

1 Like

Thank you for your response.
I thought I had forgotten all my UNIX scripts after nearly forty years exclusively in Microsoft, but as soon as I read your response and ran "man rsync" I reckon I'm on the way!
It is all beginning to come back to me.
At nearly eighty years old my learning curve might be slow, but I reckon I shall be able to transfer my entire system to Zorin OS and have it working seamlessly with others still on Microsoft within a few months.
Thanks again.
Phil

Thanks for your response.
After viewing the first tutorial, I can see the playlist is going to be useful and fun.
My UNIX from four decades ago (which I thought I had forgotten) is already coming back to me!
Thanks again.
Phil

1 Like