Cov txheej txheem:

Syncing Folders Nrog Python: 5 Kauj Ruam
Syncing Folders Nrog Python: 5 Kauj Ruam

Video: Syncing Folders Nrog Python: 5 Kauj Ruam

Video: Syncing Folders Nrog Python: 5 Kauj Ruam
Video: How To Use Docker To Make Local Development A Breeze 2024, Hlis ntuj nqeg
Anonim
Syncing Folders Nrog Python
Syncing Folders Nrog Python
Syncing Folders Nrog Python
Syncing Folders Nrog Python

Cov lus qhia no yuav qhia koj yuav ua li cas khaws ob phau ntawv (thiab txhua daim ntawv tais ceev tseg hauv lawv) ua ke yog li ib qho yog daim ntawv theej ncaj qha ntawm lwm qhov. Qhov zoo tshaj plaws rau kev txhawb nqa ua haujlwm ob leeg hauv zos, rau huab/network server lossis USB tsav. Tsis muaj kev paub nrog lub cajmeem tsim nyog los ua kom tiav cov lus qhia no. Thov nco ntsoov qhov no tsuas ua haujlwm nrog Windows txawm hais tias cov txheej txheem zoo ib yam ntawm Mac thiab Linux.

Kuv muaj lub khoos phis tawj qub Windows uas kuv tau teeb tsa ua lub server rau ntau lub luag haujlwm, ib qho uas yog lub network pheej yig txuas nrog uas ua raws li ob lub media server thiab thaub qab rau tag nrho kuv tsev neeg lub computer cov ntaub ntawv.

Raws li kuv tsev neeg txhua tus nyiam ua haujlwm hauv zos ntawm lawv lub PC, peb xav tau txoj hauv kev yooj yim los thaub qab peb cov ntaub ntawv tsis tu ncua. Kuv kuj xav tau ib txoj hauv kev kom ob npaug ntawm kev thaub qab los ntawm kev siv RAID zoo li mus rau ntawm ob lub zog tsav ntawm lub server PC. Kuv kuj tsis xav them rau ib qho software (yog kuv paub stingy kuv). Raws li qhov tsim nyog ntawm qhov no, txhua qhov software dawb zoo li tuaj nrog pop up lossis txawm tias qeeb lub PC nrog lub sijhawm sib txuas ntev thiab siv CPU loj, uas tsuas yog thab thab.

Yog li nrog kev siv zog me me, Kuv tau sau tsab ntawv nab nab uas yuav ua cov ntawv tais ceev tseg uas peb txhua tus xav tau. Kuv tuaj yeem hloov kho thiab faib qhov no rau tsev neeg raws li kev ua haujlwm uas kuv tuaj yeem teeb tsa lub qhov rais kom ua haujlwm tsis tu ncua hauv keeb kwm yav dhau. Tus neeg siv lub computer yuav tsum tsis muaj tus ntse dua.

Kauj Ruam 1: Txhim Kho Python thiab Dependencies

Txhawm rau tsim qhov kev faib tawm uas koj xav tau los nruab sej ntawm koj lub computer. Txhawm rau ua qhov no ua raws lub vev xaib txuas ntawm no https://www.python.org/downloads/ thiab nqes mus txog thaum koj pom cov version koj xav tau. Nco tseg: Hmoov tsis zoo, raws li sau tus qauv pyinstaller uas peb yuav siv tsis tau ua haujlwm tseem nrog nab hab sej 3.8 yog li koj yuav tsum tau siv qhov sib ntxiv ntawm nab hab sej (3.5-3.7).

Ua raws li kev teeb tsa los ntawm kev ua kom kos zuam "Ntxiv rau PATH" lub npov.

Thaum nruab qhib qhib qhov hais kom ua sai sai thiab teeb tsa tus nab npawb nab npawb modules peb xav tau, txhawm rau ua hom no hauv qab no thiab ua raws nrog cov lus qhia sai li sai tau:

pip nruab pyinstaller

pip nruab dirsync

Kauj ruam 2: Python Script

Tsab ntawv zoo thiab yooj yim, tsuas yog ob kab, theej thiab muab cov hauv qab no tso rau hauv ib qho IDLE (teeb tsa nrog Python) lossis sau ntawv thiab txuag ua "DirectorySync.py":

los ntawm dirsync ntshuam sync

sync ('C: / FOLDER_A', 'E: / FOLDER_B', 'sync', tshem tawm = Tseeb)

Nco ntsoov hloov ob daim nplaub tshev saum toj no nrog ob daim nplaub tshev uas koj xav ua kom tiav. Qhov rov qab ob npaug yog xav tau hauv txoj kev npe vim tias backslash yog tus yam ntxwv khiav hauv Python.

Thawj kab ntshuam dirsync module peb tau teeb tsa yav tas los.

Qhov thib ob ua qhov sync. Thawj daim nplaub tshev yog cov ntawv tais ceev tseg thiab qhov thib ob yog lub hom phiaj, 'sync' yog qhov qhia txog kev ua haujlwm sib xws yam kev sib txuas hom twg los siv. Ntxiv kev tshem tawm = Tseeb qhia txog kev ua haujlwm kom tshem tawm txhua yam hauv cov ntawv tais ceev tseg uas tsis nyob hauv cov ntawv tais ceev tseg. Muaj lwm txoj hauv kev uas tuaj yeem ua tiav raws li koj xav tau.

Txoj hauv kev nws tau teeb tsa saum toj no tseem yuav ua tiav txhua cov ntawv tais ceev tseg nyob rau hauv daim nplaub tshev theem saum toj ib yam, qhov no tuaj yeem nres yog tias xav tau. Yog tias koj xav sync ntau dua ib daim ntawv teev npe saum toj kawg nkaus, tsuas yog ntxiv kab ntau ntxiv rau koj cov cai nrog kev ua haujlwm sync (). Yog xav paub ntau ntxiv thiab pab saib hauv qab no txuas:

pypi.python.org/pypi/dirsync/2.2.2

Kauj ruam 3: Tsim.exe

Txhawm rau tsim qhov ua tiav peb tam sim no xav tau rov qab mus rau qhov hais kom ua sai.

Ntaus cov hauv qab no hloov cov ntawv tais ceev tseg nrog txoj hauv kev mus rau Phau Ntawv Teev NpeSync.py peb tsim hauv qib kawg:

pyinstaller -F -w C: /Route_to_your_folder/DirectorySync.py

Hauv daim nplaub tshev qhov chaw ntawm koj tsab ntawv nab nab no tsim cov kab ntawv sib dhos: _pycache_, tsim, deb thiab ob lwm cov ntaub ntawv. Hauv daim nplaub tshev tam sim tam sim no cov ntaub ntawv hu ua DirectorySync.exe, khiav qhov no yuav ua qhov sib txuas hauv keeb kwm yav dhau. Cov ntaub ntawv no tuaj yeem faib tau ib yam rau ib tus neeg thiab lawv tuaj yeem ua haujlwm sib txuas yam tsis tas yuav muaj nab hab sej nruab rau hauv computer.

Txhawm rau piav qhia dab tsi tshwm sim hauv BOLD cov ntawv uas tau ntaus rau hauv qhov hais kom ua:

'pyinstaller' qhia lub khoos phis tawj siv tus qauv pyinstaller uas peb rub tawm ua ntej

'-F' yog qhov kev xaiv uas qhia pyinstaller tsuas yog tsim kom muaj ib qho ua haujlwm tau thiab tsis yog cov ntawv tais ceev tseg uas tseem yuav tau muab faib rau.

'-w' yog qhov kev xaiv uas qhia rau lub khoos phis tawj kom tsis tso tawm qhov hais kom sai txhua lub sijhawm nws sau tsab ntawv.

Txoj hauv kev yog txoj kev mus rau tsab ntawv nab nab.

Yog xav paub ntau ntxiv thiab pab saib hauv qab no txuas:

pyinstaller.readthedocs.io/en/stable/usage…

Kauj ruam 4: Khiav Yeej

Tam sim no koj tau npaj los ua ke txhua cov ntawv tais ceev tseg yam tsis tas yuav theej, muab tshuaj txhuam thiab tshem tawm ntau zaus los ntawm ob npaug nyem rau ntawm qhov ua tiav. Tab sis peb xav mus ib kauj ruam ntxiv dua li ntawd thiab muaj Windows khiav cov txheej txheem cia li yog li koj tsis tas yuav txhawj xeeb.

Txhawm rau ua qhov no peb yuav siv Task Scheduler program uas los nrog Windows, cov txheej txheem no yog ua raws Windows 10 tab sis yuav luag zoo ib yam ntawm lwm lub Windows platforms.

  1. Qhib Task Teem Sijhawm los ntawm cov ntawv qhia zaub mov pib.
  2. Ntawm sab tes xis xaiv 'Tsim Ua Haujlwm' los ntawm cov ntawv qhia zaub mov.
  3. Muab nws lub npe thiab lus piav qhia thiab hauv qab kom ntseeg tau tias nws tau teeb tsa rau txoj haujlwm ua haujlwm raug.
  4. Ntawm qhov 'Triggers' tab, tsim qhov tshwm sim tshiab los ntawm txhaj rau 'Tshiab' nyob rau hauv qab sab laug, ntawm qhov tshiab pop up xaiv cov teeb tsa uas koj xav tau, Kuv tau xaiv los pib ua haujlwm ntawm Log on thiab rov ua dua txhua teev yog li kuv paub muaj thaub qab ntawm kuv cov haujlwm txhua teev. Nyem OK.
  5. Ntawm 'Ua Haujlwm' tab tsim qhov kev nqis tes ua tshiab ib yam nkaus. Qhov kev txiav txim peb xav tau yog pib qhov program uas yog lub neej ntawd. Xauj mus rau qhov ua tiav uas peb tau tsim ua ntej thiab xaiv. NCO TSEG:- yog tias koj txav qhov ua tiav tom qab tsim txoj haujlwm, txoj haujlwm thiab yog li kev sib koom yuav tsis ua tiav.
  6. Ntawm 'Cov xwm txheej' tab de-khij lub zog teeb tsa kom nws yuav khiav ntawm roj teeb ntxiv rau ntsaws rau hauv.
  7. Nyem OK thiab tam sim no koj tau tsim koj txoj haujlwm.

Pib dua lub khoos phis tawj thiab tom qab ib pliag tshawb xyuas lub hom phiaj chaw nyob thiab pom tias kev ua haujlwm sib xws, thov nco ntsoov yog tias koj muaj daim nplaub tshev loj, kev sib koom yuav siv sijhawm ib ntus los theej tag nrho cov ntawv tais ceev tseg thawj zaug.

Qhov ntawd yog kev qhia ua tiav, Kuv vam tias koj pom nws muaj txiaj ntsig, muaj lus nug, qhia rau kuv paub.

Kauj Ruam 5: Hloov Kho 15 Lub Ib Hlis 2020 - Rub Tawm Txoj Haujlwm

Kuv tseem siv qhov program no uas tau ua haujlwm zoo rau kuv Txawm li cas los xij kuv tau nquag nug los ntawm tib neeg kom ua ib qho tawm ntawm kev ua haujlwm sib txawv rau cov ntawv sib txawv ntawm tus kheej thiab lwm yam.. Nws muab cov neeg siv sib tham kom tib neeg tuaj yeem yooj yim ua ib qho ntawm cov haujlwm sib xws. Qhov program tuaj yeem rub tawm los ntawm Github.

Pom zoo: