Saturday, July 4, 2020

#26 2020-05-09 06:10:29 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6395

Re: Bash for loop Script or Service to Copy Folders and Archive in one go?

Yvan,

You could make your script more efficient by ignoring files that have not changed, something like this:

Applescript:

if not (fileManager's contentsEqualAtPath:POSIXPath andPath:(destURL's |path|())) then

But that's only going to work with files, not folders or packages.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Online

 

#27 2020-05-10 02:44:19 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4533

Re: Bash for loop Script or Service to Copy Folders and Archive in one go?

Thank you Shane but I tried to achieve what was described by the OP:

Inside the subfolders there are several other folders.
My archive process is to copy All the folders except Backup, into Backup.
Once copied, zip Backup.



If I read well, it was asked to copy the folders with their subfolders, not to copy only newly added or changed items.
It's the way I work for my files because I like to keep old versions which may prove to be useful one day. I retrieve them in the date stamped archives.
It resemble to what is done by Time Machine which keep the old versions (as well as the hidden folder .DocumentRevisions-V100 from which I extracted numerous Pages or Numbers documents to help really annoyed askers).
If I understand well the schemes proposed by Peavine replace the old versions by the new ones.
I don't criticize this behavior, it's just not what was asked (at least the way I understood the question which may be the wrong one).

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 10 mai 2020 10:44:06

Offline

 

#28 2020-05-10 08:19:07 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4533

Re: Bash for loop Script or Service to Copy Folders and Archive in one go?

Shane Stanley wrote:
Yvan Koenig wrote:

In every cases, copy itemA to itemB replace the original contents of itemB by the contents of itemA



That's not the case with APFS volumes. Copying works very much like moving, with seperate contents only made when one or the other is modified (and even then, only of the modified part).




Hi Shane, in my message I carefully wrote:

I described the way both commands behave under High Sierra.
If I remember well, under Catalina it's different. Copy an item just create a new 'descriptor' of the item so that we may have 10 copies but have only one physical 'copy' of the embedded datas.



Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 10 mai 2020 16:19:02

Last edited by Yvan Koenig (2020-05-10 08:19:39 am)

Offline

 

#29 2020-05-10 08:35:40 am

FreddieMac
Member
Registered: 2019-11-14
Posts: 38

Re: Bash for loop Script or Service to Copy Folders and Archive in one go?

Thanks everyone,

Like someone said here in this post, there's enough here to cobble up a good script.
I apologize for my poor description of my results.
I never expected such audacious effort to help me with my request. I really appreciate everyone's contributions. I will take a few hours to suit a script for my unique special needs. Thanks again. ????

Offline

 

#30 2020-05-10 06:12:28 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6395

Re: Bash for loop Script or Service to Copy Folders and Archive in one go?

Yvan,

I missed that, sorry. But the key point is that it's not the version of macOS, but rather the format of the disk.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Online

 

#31 2020-05-11 12:49:37 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4533

Re: Bash for loop Script or Service to Copy Folders and Archive in one go?

Thank's Shane.
I read too fast the infos about changes and didn't took care that these ones are linked to the format nt to the version of OS.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 11 mai 2020 08:49:32

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)