File: android-deltas-sync/_etc/examples/windows-pc-example/runs/x-create-fixednames-zipfile-on-macos.txt

Steps run on macOS to create the Windows initial-content zip, with 
counts useful for verification at the end of the process on the phone.
This zip and filenames fix was both run on macOS; names must be fixed 
on Unix _before_ transferring to and unzipping on Windows, else unzips 
on Windows may discard files or mangle differently (e.g., "\" in Unix
filenames may generate Windows subfolders).  Setup:

$ C=/Users/me/MY-STUFF/Code      # code dir
$ Z=$C/mergeall/test/ziptools    # ziptools dir
$ cd ~/Desktop/temp              # test dir


#---------------------------------------------------------------------------
# Extract the unfixed content
#---------------------------------------------------------------------------


~/Desktop/temp$ rm -rf test-ads
~/Desktop/temp$ cp $C/fold3-vs-deltas/android-deltas-sync/_etc/examples/_test-ads.zip .
~/Desktop/temp$ py3 $Z/zip-extract.py _test-ads.zip . -permissions
Running ziptools 1.3
Unzipping from _test-ads.zip to .
Extracted test-ads/
Extracted test-ads/White House sees supply chain-related price pressures abating, can't say exactly when | Reuters.html
Extracted test-ads/z-fold-3/
Extracted test-ads/z-fold-3/Samsung Galaxy Z Fold 3 announced with S Pen support and water resistance - The Verge.html
Extracted test-ads/z-fold-3/Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! | Android Central.html
Extracted test-ads/z-fold-3/48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 | Digital Trends.html
Extracted test-ads/z-fold-3/Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) | Beebom.html
Extracted test-ads/z-fold-3/more/
Extracted test-ads/z-fold-3/more/more/
Extracted test-ads/z-fold-3/more/more/mergeall.py
Extracted test-ads/z-fold-3/My Order History | Samsung US.html
Extracted test-ads/z-fold-3/Galaxy Z Fold3 5G 512GB (Unlocked) Phones | Samsung US.html
Extracted test-ads/z-fold-3/ZFold3_Carousel_MainSingleKVDT-765x465.webp
Extracted test-ads/z-fold-3/ZFold3_Carousel_ProductImage_PhantomBlackDT-765x465.webp
Extracted test-ads/z-fold-3/10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 | ZDNet.html
Extracted test-ads/a|b.txt
Extracted test-ads/U.S. consumer prices post largest gain in 13 years; inflation has likely peaked | Reuters.html
Extracted test-ads/Fed keen to be 'well positioned' to act on inflation, other risks, minutes show | Reuters.html
Extracted test-ads/folder-\\ | < > ? * : " ^/
Extracted test-ads/folder-\\ | < > ? * : " ^/folder-\\ | < > ? * : " ^/
Extracted test-ads/folder-\\ | < > ? * : " ^/folder-\\ | < > ? * : " ^/\\ | < > ? * : " ^
(Link) Extracted test-ads/not:okay?link
Extracted test-ads/a?b copy 8.txt
(Link) Extracted test-ads/okaylink
Extracted test-ads/not<okay?link-nested/
(Link) Extracted test-ads/not<okay?link-nested/not<okay?link
Extracted test-ads/z-fold-3.txt
Extracted test-ads/\\ | < > ? * : " ^
Extract finished: files=18, folders=7, symlinks=3, unknowns=0.


#---------------------------------------------------------------------------
# Inspect nonportable names
#---------------------------------------------------------------------------


~/Desktop/temp$ py3 $Z/fix-nonportable-filenames.py test-ads -
FINDING the following without making changes: ['\x00', '/', '\\', '|', '<', '>', '?', '*', ':', '"']
Continue (y or n)? y

 test-ads/folder-\\ | < > ? * : " ^ =>
 test-ads/folder-__ _ _ _ _ _ _ _ ^

 test-ads/not<okay?link-nested =>
 test-ads/not_okay_link-nested

 test-ads/White House sees supply chain-related price pressures abating, can't say exactly when | Reuters.html =>
 test-ads/White House sees supply chain-related price pressures abating, can't say exactly when _ Reuters.html

 test-ads/a|b.txt =>
 test-ads/a_b.txt

 test-ads/U.S. consumer prices post largest gain in 13 years; inflation has likely peaked | Reuters.html =>
 test-ads/U.S. consumer prices post largest gain in 13 years; inflation has likely peaked _ Reuters.html

 test-ads/Fed keen to be 'well positioned' to act on inflation, other risks, minutes show | Reuters.html =>
 test-ads/Fed keen to be 'well positioned' to act on inflation, other risks, minutes show _ Reuters.html

 test-ads/not:okay?link =>
 test-ads/not_okay_link

 test-ads/a?b copy 8.txt =>
 test-ads/a_b copy 8.txt

 test-ads/\\ | < > ? * : " ^ =>
 test-ads/__ _ _ _ _ _ _ _ ^

 test-ads/z-fold-3/Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! | Android Central.html =>
 test-ads/z-fold-3/Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! _ Android Central.html

 test-ads/z-fold-3/48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 | Digital Trends.html =>
 test-ads/z-fold-3/48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 _ Digital Trends.html

 test-ads/z-fold-3/Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) | Beebom.html =>
 test-ads/z-fold-3/Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) _ Beebom.html

 test-ads/z-fold-3/My Order History | Samsung US.html =>
 test-ads/z-fold-3/My Order History _ Samsung US.html

 test-ads/z-fold-3/Galaxy Z Fold3 5G 512GB (Unlocked) Phones | Samsung US.html =>
 test-ads/z-fold-3/Galaxy Z Fold3 5G 512GB (Unlocked) Phones _ Samsung US.html

 test-ads/z-fold-3/10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 | ZDNet.html =>
 test-ads/z-fold-3/10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 _ ZDNet.html

 test-ads/folder-\\ | < > ? * : " ^/folder-\\ | < > ? * : " ^ =>
 test-ads/folder-\\ | < > ? * : " ^/folder-__ _ _ _ _ _ _ _ ^

 test-ads/folder-\\ | < > ? * : " ^/folder-\\ | < > ? * : " ^/\\ | < > ? * : " ^ =>
 test-ads/folder-\\ | < > ? * : " ^/folder-\\ | < > ? * : " ^/__ _ _ _ _ _ _ _ ^

 test-ads/not<okay?link-nested/not<okay?link =>
 test-ads/not<okay?link-nested/not_okay_link

Visited 21 files and 6 folders
Total nonportable names found but unchanged: 18


#---------------------------------------------------------------------------
# Fix nonportable names
#---------------------------------------------------------------------------


~/Desktop/temp$ py3 $Z/fix-nonportable-filenames.py test-ads
REPLACING the following with "_" in all names: ['\x00', '/', '\\', '|', '<', '>', '?', '*', ':', '"']
Continue (y or n)? y

 test-ads/folder-\\ | < > ? * : " ^ =>
 test-ads/folder-__ _ _ _ _ _ _ _ ^

 test-ads/not<okay?link-nested =>
 test-ads/not_okay_link-nested

 test-ads/White House sees supply chain-related price pressures abating, can't say exactly when | Reuters.html =>
 test-ads/White House sees supply chain-related price pressures abating, can't say exactly when _ Reuters.html

 test-ads/a|b.txt =>
 test-ads/a_b.txt

 test-ads/U.S. consumer prices post largest gain in 13 years; inflation has likely peaked | Reuters.html =>
 test-ads/U.S. consumer prices post largest gain in 13 years; inflation has likely peaked _ Reuters.html

 test-ads/Fed keen to be 'well positioned' to act on inflation, other risks, minutes show | Reuters.html =>
 test-ads/Fed keen to be 'well positioned' to act on inflation, other risks, minutes show _ Reuters.html

 test-ads/not:okay?link =>
 test-ads/not_okay_link

 test-ads/a?b copy 8.txt =>
 test-ads/a_b copy 8.txt

 test-ads/\\ | < > ? * : " ^ =>
 test-ads/__ _ _ _ _ _ _ _ ^

 test-ads/z-fold-3/Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! | Android Central.html =>
 test-ads/z-fold-3/Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! _ Android Central.html

 test-ads/z-fold-3/48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 | Digital Trends.html =>
 test-ads/z-fold-3/48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 _ Digital Trends.html

 test-ads/z-fold-3/Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) | Beebom.html =>
 test-ads/z-fold-3/Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) _ Beebom.html

 test-ads/z-fold-3/My Order History | Samsung US.html =>
 test-ads/z-fold-3/My Order History _ Samsung US.html

 test-ads/z-fold-3/Galaxy Z Fold3 5G 512GB (Unlocked) Phones | Samsung US.html =>
 test-ads/z-fold-3/Galaxy Z Fold3 5G 512GB (Unlocked) Phones _ Samsung US.html

 test-ads/z-fold-3/10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 | ZDNet.html =>
 test-ads/z-fold-3/10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 _ ZDNet.html

 test-ads/folder-__ _ _ _ _ _ _ _ ^/folder-\\ | < > ? * : " ^ =>
 test-ads/folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^

 test-ads/folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^/\\ | < > ? * : " ^ =>
 test-ads/folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^/__ _ _ _ _ _ _ _ ^

 test-ads/not_okay_link-nested/not<okay?link =>
 test-ads/not_okay_link-nested/not_okay_link

Visited 21 files and 6 folders
Total nonportable names found and changed: 18

~/Desktop/temp$ py3 $Z/fix-nonportable-filenames.py test-ads -
FINDING the following without making changes: ['\x00', '/', '\\', '|', '<', '>', '?', '*', ':', '"']
Continue (y or n)? y

Visited 21 files and 6 folders
Total nonportable names found but unchanged: 0


#---------------------------------------------------------------------------
# Check results' counts
#---------------------------------------------------------------------------


~/Desktop/temp$ py3 $C/mergeall/diffall.py test-ads/ test-ads/ -skipcruft
diffall 3.2 starting
--------------------
Comparing test-ads/ to test-ads/
Directory lists are identical
Comparing contents
Fed keen to be 'well positioned' to act on inflation, other risks, minutes show _ Reuters.html matches
U.S. consumer prices post largest gain in 13 years; inflation has likely peaked _ Reuters.html matches
a_b.txt matches
White House sees supply chain-related price pressures abating, can't say exactly when _ Reuters.html matches
okaylink matches
not_okay_link matches
z-fold-3.txt matches
a_b copy 8.txt matches
__ _ _ _ _ _ _ _ ^ matches
--------------------
Comparing test-ads//z-fold-3 to test-ads//z-fold-3
Directory lists are identical
Comparing contents
Galaxy Z Fold3 5G 512GB (Unlocked) Phones _ Samsung US.html matches
Samsung Galaxy Z Fold 3 announced with S Pen support and water resistance - The Verge.html matches
Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! _ Android Central.html matches
10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 _ ZDNet.html matches
My Order History _ Samsung US.html matches
Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) _ Beebom.html matches
48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 _ Digital Trends.html matches
ZFold3_Carousel_MainSingleKVDT-765x465.webp matches
ZFold3_Carousel_ProductImage_PhantomBlackDT-765x465.webp matches
--------------------
Comparing test-ads//z-fold-3/more to test-ads//z-fold-3/more
Directory lists are identical
Comparing contents
--------------------
Comparing test-ads//z-fold-3/more/more to test-ads//z-fold-3/more/more
Directory lists are identical
Comparing contents
mergeall.py matches
--------------------
Comparing test-ads//folder-__ _ _ _ _ _ _ _ ^ to test-ads//folder-__ _ _ _ _ _ _ _ ^
Directory lists are identical
Comparing contents
--------------------
Comparing test-ads//folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^ to test-ads//folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^
Directory lists are identical
Comparing contents
__ _ _ _ _ _ _ _ ^ matches
--------------------
Comparing test-ads//not_okay_link-nested to test-ads//not_okay_link-nested
Directory lists are identical
Comparing contents
not_okay_link matches
================================================================================
Runtime hrs:mins:secs = 0:0:0.01
Files checked: 18, Folders checked: 7, Symlinks checked: 3, Files skipped: 0
System metadata (cruft) files were skipped
No diffs found.
End of report.


#---------------------------------------------------------------------------
# Check results against a prior save
#---------------------------------------------------------------------------


~/Desktop/temp$ py3 $C/mergeall/diffall.py test-ads/ test-ads-save/ -skipcruft
diffall 3.2 starting
--------------------
Comparing test-ads/ to test-ads-save/
Directory lists are identical
Comparing contents
Fed keen to be 'well positioned' to act on inflation, other risks, minutes show _ Reuters.html matches
U.S. consumer prices post largest gain in 13 years; inflation has likely peaked _ Reuters.html matches
a_b.txt matches
White House sees supply chain-related price pressures abating, can't say exactly when _ Reuters.html matches
okaylink matches
not_okay_link matches
z-fold-3.txt matches
a_b copy 8.txt matches
__ _ _ _ _ _ _ _ ^ matches
--------------------
Comparing test-ads//z-fold-3 to test-ads-save//z-fold-3
Directory lists are identical
Comparing contents
Galaxy Z Fold3 5G 512GB (Unlocked) Phones _ Samsung US.html matches
Samsung Galaxy Z Fold 3 announced with S Pen support and water resistance - The Verge.html matches
Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! _ Android Central.html matches
10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 _ ZDNet.html matches
My Order History _ Samsung US.html matches
Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) _ Beebom.html matches
48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 _ Digital Trends.html matches
ZFold3_Carousel_MainSingleKVDT-765x465.webp matches
ZFold3_Carousel_ProductImage_PhantomBlackDT-765x465.webp matches
--------------------
Comparing test-ads//z-fold-3/more to test-ads-save//z-fold-3/more
Directory lists are identical
Comparing contents
--------------------
Comparing test-ads//z-fold-3/more/more to test-ads-save//z-fold-3/more/more
Directory lists are identical
Comparing contents
mergeall.py matches
--------------------
Comparing test-ads//folder-__ _ _ _ _ _ _ _ ^ to test-ads-save//folder-__ _ _ _ _ _ _ _ ^
Directory lists are identical
Comparing contents
--------------------
Comparing test-ads//folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^ to test-ads-save//folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^
Directory lists are identical
Comparing contents
__ _ _ _ _ _ _ _ ^ matches
--------------------
Comparing test-ads//not_okay_link-nested to test-ads-save//not_okay_link-nested
Directory lists are identical
Comparing contents
not_okay_link matches
================================================================================
Runtime hrs:mins:secs = 0:0:0.01
Files checked: 18, Folders checked: 7, Symlinks checked: 3, Files skipped: 0
System metadata (cruft) files were skipped
No diffs found.
End of report.


#---------------------------------------------------------------------------
# Make the Windows zip from fixed names
#---------------------------------------------------------------------------


~/Desktop/temp$ py3 $Z/zip-create.py _test-ads-windows.zip test-ads -skipcruft
Running ziptools 1.3
Zipping ['test-ads'] to _test-ads-windows.zip
Cruft patterns: {'skip': ['.*', '[dD]esktop.ini', 'Thumbs.db', '~*', '$Recycle.bin', '*.py[co]', '__pycache__'], 'keep': ['.htaccess*', '.login', '.bash*', '.profile', '.svn', '.nomedia']}
Adding folder test-ads
Adding  file  test-ads/Fed keen to be 'well positioned' to act on inflation, other risks, minutes show _ Reuters.html
Adding folder test-ads/z-fold-3
Adding  file  test-ads/z-fold-3/Galaxy Z Fold3 5G 512GB (Unlocked) Phones _ Samsung US.html
Adding  file  test-ads/z-fold-3/Samsung Galaxy Z Fold 3 announced with S Pen support and water resistance - The Verge.html
Adding  file  test-ads/z-fold-3/Samsung Galaxy Z Fold 3 News, Leaks, Release, Specs, and Rumors! _ Android Central.html
Adding  file  test-ads/z-fold-3/10 reasons to upgrade from Samsung's Galaxy Z Fold 2 to the Z Fold 3 _ ZDNet.html
Adding  file  test-ads/z-fold-3/My Order History _ Samsung US.html
Adding folder test-ads/z-fold-3/more
Adding folder test-ads/z-fold-3/more/more
Adding  file  test-ads/z-fold-3/more/more/mergeall.py
Adding  file  test-ads/z-fold-3/Galaxy Z Fold 3 FAQ Everything You Need to Know (2021) _ Beebom.html
Adding  file  test-ads/z-fold-3/48 Hours with the Samsung Galaxy Z Fold 3 and Z Flip 3 _ Digital Trends.html
Adding  file  test-ads/z-fold-3/ZFold3_Carousel_MainSingleKVDT-765x465.webp
Adding  file  test-ads/z-fold-3/ZFold3_Carousel_ProductImage_PhantomBlackDT-765x465.webp
Adding  file  test-ads/U.S. consumer prices post largest gain in 13 years; inflation has likely peaked _ Reuters.html
Adding  file  test-ads/a_b.txt
Adding folder test-ads/folder-__ _ _ _ _ _ _ _ ^
Adding folder test-ads/folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^
Adding  file  test-ads/folder-__ _ _ _ _ _ _ _ ^/folder-__ _ _ _ _ _ _ _ ^/__ _ _ _ _ _ _ _ ^
Adding folder test-ads/not_okay_link-nested
Adding  link  ~file test-ads/not_okay_link-nested/not_okay_link
Adding  file  test-ads/White House sees supply chain-related price pressures abating, can't say exactly when _ Reuters.html
Adding  link  ~file test-ads/okaylink
Adding  link  ~file test-ads/not_okay_link
Adding  file  test-ads/z-fold-3.txt
Adding  file  test-ads/a_b copy 8.txt
Adding  file  test-ads/__ _ _ _ _ _ _ _ ^
Create finished: files=18, folders=7, symlinks=3, unknowns=0, crufts=0.


#---------------------------------------------------------------------------
# Copy and check the zip
#---------------------------------------------------------------------------


~/Desktop/temp$ cp -p _test-ads-windows.zip $C/fold3-vs-deltas/android-deltas-sync/_etc/examples
~/Desktop/temp$ cmp   _test-ads-windows.zip $C/fold3-vs-deltas/android-deltas-sync/_etc/examples/_test-ads-windows.zip 
~/Desktop/temp$ cmp   _test-ads.zip         $C/fold3-vs-deltas/android-deltas-sync/_etc/examples/_test-ads.zip 



[Home page] Books Code Blog Python Author Train Find ©M.Lutz