.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gyexamples/plot_sync.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gyexamples_plot_sync.py: =================== Syncing two folders =================== This example is about syncing two folders or creating a backup. .. GENERATED FROM PYTHON SOURCE LINES 12-15 .. code-block:: default import os from pyquickhelper.filehelper import synchronize_folder .. GENERATED FROM PYTHON SOURCE LINES 16-24 .. code-block:: default dest = "temp_sync" if not os.path.exists(dest): print("creating", dest) os.makedirs(dest) else: print("folder already created", dest) .. rst-class:: sphx-glr-script-out .. code-block:: none creating temp_sync .. GENERATED FROM PYTHON SOURCE LINES 25-41 .. code-block:: default try: copy = os.path.dirname(__file__) except NameError: # __file__ does not exist when run with sphinx-gallery copy = "." paths_to_try = [os.path.join("..", "notebooks"), os.path.join("_doc", "notebooks")] for path in paths_to_try: src = os.path.abspath(path) if os.path.exists(src): break src = os.path.abspath(src) synchronize_folder(src, dest, fLOG=print) .. rst-class:: sphx-glr-script-out .. code-block:: none [synchronize_folder] from 'somewhere/workspace/pyquickhelper/pyquickhelper_UT_39_std/_doc/notebooks' [synchronize_folder] to 'temp_sync' [synchronize_folder] exploring f1='somewhere/workspace/pyquickhelper/pyquickhelper_UT_39_std/_doc/notebooks' [synchronize_folder] number of found files (p1) 19 2023-06-02 23:49:10.189329 [synchronize_folder] exploring f2='temp_sync' [synchronize_folder] number of found files (p2) 1 2023-06-03 00:37:08.889947 [synchronize_folder] Starting synchronisation. [synchronize_folder] ... 1/18 (current: 'README.txt' :: >+) [synchronize_folder] ... 2/18 (current: 'check_matplotlib_backend.ipynb' :: >+) [synchronize_folder] ... 3/18 (current: 'compare_files.ipynb' :: >+) [synchronize_folder] ... 4/18 (current: 'compare_python_distribution.ipynb' :: >+) [synchronize_folder] ... 5/18 (current: 'example_about_files.ipynb' :: >+) [synchronize_folder] ... 6/18 (current: 'example_completion.ipynb' :: >+) [synchronize_folder] ... 7/18 (current: 'example_documentation.ipynb' :: >+) [synchronize_folder] ... 8/18 (current: 'example_nbimage.ipynb' :: >+) [synchronize_folder] ... 9/18 (current: 'example_pyquickhelper.ipynb' :: >+) [synchronize_folder] ... 10/18 (current: 'example_with_comments.ipynb' :: >+) [synchronize_folder] ... 11/18 (current: 'exemple_of_fix_menu.ipynb' :: >+) [synchronize_folder] ... 12/18 (current: 'git_dataframes.ipynb' :: >+) [synchronize_folder] ... 13/18 (current: 'having_a_form_in_a_notebook.ipynb' :: >+) [synchronize_folder] ... 14/18 (current: 'javascript_extension.ipynb' :: >+) [synchronize_folder] ... 15/18 (current: 'nbimage.png' :: >+) [synchronize_folder] ... 16/18 (current: 'notebook_with_svg.ipynb' :: >+) [synchronize_folder] ... 17/18 (current: 'profiling.ipynb' :: >+) [synchronize_folder] ... 18/18 (current: 'simple_example.ipynb' :: >+) [synchronize_folder] END: no copy [('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync'), ('>+', , 'temp_sync')] .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.044 seconds) .. _sphx_glr_download_gyexamples_plot_sync.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_sync.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_sync.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_