I-Script Bash: kopisha izithombe ezintsha kusuka ku-SD uye kwi-PC

Kwesinye isikhathi sidinga ukwenza imisebenzi ephindaphindwayo kwi-PC yethu, ethi ngokuhamba kwesikhathi ibe yisicefe. Kwezinye izimo singawenza lula umsebenzi wethu ngokusebenzisa imibhalo esisebenzelayo.

Namuhla ngibhala ukukukhombisa iskripthi se-bash esixazulule isidingo: kopisha izithombe ezintsha kusuka kukhamera yami yedijithali kusuka ekhadini le-SD kuye kwi-PC.

Isimo:

Njalo lapho nginezithombe ezintsha engingazilanda kukhompyutha yami, ngangingenza okulandelayo:

1. Vula umkhombandlela lapho nginezithombe ezihlukaniswe khona kwizikhombisi ezingaphansi.

2. Dala umkhombandlela ongaphansi omncane onegama ledethi yamanje, ngefomethi yy.mm.dd

3. Hambisa kumkhombandlela ongaphansi owenziwe ngesikhathi esedlule bese ubona ukuthi yisiphi isithombe sokugcina esilondoloziwe.

4. Kopisha izithombe ezintsha kusuka ekhadini le-SD uye enkombeni esanda kwenziwa.

Lokhu kuthatha okungadluli kumzuzu, kepha kulula ukuthi inqubo yenziwe ngokufaka ikhadi.

Kufanele ngisebenzise ikhadi ngoba angikwazi ukudlulisa ngqo izithombe ezivela kwikhamera nge-USB, ngoba azikho izishayeli zeLinux (njengoba kwenzeka njalo…)

Isixazululo:

Dala iskripthi se-bash esenza okulandelayo:

1. Qinisekisa ekuqaleni uma ikhadi le-SD lifakiwe. Ngaphandle kwalokho iyaphela.

2. Iya enkombeni enkulu yezithombe bese uthola eyokugcina. Gcina igama lakho ngokuguquguqukayo.

3. Qhathanisa usuku lwamanje nomkhombandlela wokugcina, uma wehlukile, dala umkhombandlela omusha onegama ledethi yamanje ngefomethi ye- "yy.mm.dd".

4. Hambisa kwisikhombi sokugcina (hhayi esisha, kepha esidala) bese ugcine igama lefayela lokugcina elidluliselwe esikhathini esedlule ngokuguquguqukayo.

Kulesi sinyathelo kuyadingeka ukuhlunga igama lefayela ukuze likwazi ukuqhathaniswa namafayela amasha asekhadini kungekudala. Amafayela anefomethi elandelayo: xxxmxolisi Kuphi: x = idijithi 0 kuye ku-9 ne-eee = extension (JPG, MOV). Isibonelo: 100_5684.JPG, 100_5699.MOV. Ngemuva kwesihlungi, igama lihlala liyi-xxxxxxx Ngakho-ke, esibonelweni esingenhla, sizoba: 1005684, 1005699.

Njengoba umkhombandlela ungaba nezinye izinhlobo zamafayela noma unamagama ashintshiwe, isihlungi siyasetshenziswa.

5. Hambisa ekhadini bese uhlunga amafayela njengasesithombeni sangaphambilini.

6. Qhathanisa amafayela asekhadini nokuguquguqukayo okuqukethe ifayela lokugcina elidluliselwe esikhathini esedlule (iphuzu 4) bese ukopisha amafayela aqanjwe igama enkombeni esanda kwenziwa kukhulu kunokuguquguqukayo. (ngoba amagama ayizinombolo nje).

7. Vula umkhombandlela oqukethe izithombe ezintsha nomphathi wefayela.

Okulandelayo ngikukhombisa iskripthi esinamazwana achaza ukuthi sisebenza kanjani. Ngiyacacisa ukuthi angisiye umqambi wohlelo futhi kunginike amakhanda amaningi ngaze ngawathola ukuthi asebenze, ikakhulukazi lapho bekufanele ngihlunge amagama e-loop "ye".

#! / bin / bash ### --- QINISEKA UMA I-SD IKHWEZISIWE - ### SD = / media / KODAK / DCIM / 100Z8612 uma [[-d $ SD]]; bese ### --- DALA ISIQONDISO --- # # # #Funda umkhombandlela wezithombe bese udala enye enegama ledethi le #current nezimvume ezingama-755 uma ingekho. cd ~ / Izithombe / kodak ULTDIR = `ls -1 | tail -n1` # umkhombandlela wokugcina ohlwini. DATE = `date +% y.% M.% D` #Durrent date in YY.MM.DD format if [" $ LASTDIR "! =" $ DATE "]; bese mkdir -vm 755`date +% y.% m.% d` # dala umkhombandlela onedethi yamanje fi ### --- BHEKA IFAYILI LOKUGCINA LAMA $ ULTDIR --- ### cd $ ULTDIR ULTIMG = `ls - 1 [0-9] [0-9] [0-9] _ [0-9] [0-9] [0-9] [0-9]. [JM] [PO] [GV] | umsila -n1 | cut -c1-3,5-8` # see the last image with name xxx_XXXX.eee .eee = extension file (JPG or MOV) # Ukuqinisekisa ukuthi iskripthi siyasebenza ngemuva kokuthi sigcwalisekile: # 100_9999.eee -> 101_0000. eee futhi awekho amaphutha # SIKA ukuze kube ngefomethi xxxXXXX ### --- HAMBA UYA KULAWULO LOKUGCINA LOLUHLU --- # # # # NOMA OKWENZIWE Kamuva, UMA i- # cd YADALWA .. NGOKUGCINE = `ls -1 | tail -n1` # goes again ngoba uma kungenjalo kuthatha i-ULTDIR yangaphambilini ye- if cd / media / KODAK / DCIM / 100Z8612 ### --- FILTER the files in SD --- ### FILTER = `ls -1 [ 0 -9] [0-9] [0-9] _ [0-9] [0-9] [0-9] [0-9]. [JM] [PO] [GV] `# # # - - Qhathanisa AMAFAYILI AMASHA NEGAMA KAKHULU KUNOKUGCINA NGOKUGCINA - ### for I in $ FILTER do N = `echo $ I | cut -c1-3,5-8` #Qeda igama uma [["$ ULTIMG" -lt "$ N"]]; bese u-cp $ I ~ / Izithombe / kodak / $ ULTDIR wenze i-thunar ~ / Izithombe / kodak / $ ULTDIR #Vula umkhombandlela omusha ngeThunar else exit 0 fi exit 0

Ekugcineni ukuyenza isebenze, ngiyingeze kuhlelo lwe-Xfce "lweDrayivu Esuswayo neMidiya" kwimenyu

Izilungiselelo → Umphathi Wezilungiselelo we-Xfce 4 → AmaDrayivu Asusekayo neMidiya → Amakhamera

usebenzisa inketho yesithombe sokungenisa. Lapho ngifaka ikhadi, ibhokisi lengxoxo liyabuza ukuthi ngifuna ukungenisa izithombe. Ngokwamukela, iskripthi siyenziwa.

Kulungile-ke. Uxolo ngokungahambi kahle kombhalo, yiposi yami yokuqala futhi angazi ukuthi ngingawubeka kanjani umbhalo lapho ngiwuhlela. Ngiyethemba kuyasiza kothile okungenani ukuthi abe nombono futhi awuvumelanise nesimo ngasinye.

Angizange nginikeze ilayisense ngoba angizazisanga kahle ngohlobo ngalunye lwe-GPL, kepha banenkululeko yokuyikopisha nokuyiguqula. Futhi zizwe ukhululekile ukusho ukuthi kungathuthukiswa kanjani noma uma kunezinye izindlela zokwenza okufanayo, kepha kube lula.

Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-13, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   Percaff_TI99 kusho

    I-Joaquín ethakazelisa kakhulu, umqondo omuhle ukufaka iskripthi kunamathisela lapho kulula khona ukwabelana ngekhodi, futhi njengoba usho ukuthi ingashintshelwa kwezinye izidingo futhi umuntu afunde ukusebenzisa ibash kancane.

    Ukubingelela!

    1.    Joaquin kusho

      Kwenziwe, kungezwe http://paste.desdelinux.net/4737
      Gracias!

  2.   vr_rv kusho

    Lapho ukopisha isithombe esivele sisenkombeni, asibonisi ukuthi sesivele sikhona futhi sikunikeza nethuba lokusifaka esikhundleni saso noma ungasikopishi?

    Noma kunjalo ilusizo kakhulu, ngoba yenza konke ngokuzenzakalela

    1.    Joaquin kusho

      Sawubona. Empeleni ayikopishi izithombe eziphindaphindwayo, iyaziziba nje. Umqondo wawukopisha kahle amafayela amasha ngaphandle kwesidingo sokusebenzisana komsebenzisi. Futhi, ngaphandle kokuthi ungeze izithombe ngaphezu kwesisodwa ngosuku, iskripthi sikopisha amafayela amasha enkombeni entsha. Ngichaza kafushane:

      Namuhla ngu-10/03/13, ngenza umkhombandlela obizwa nge-13.03.10/100/4440 bese ngikopisha ezinye izithombe noma ividiyo (MOV) ngaphakathi: 100_4441.JPG, 100_4442.JPG, 100_4445.MOV, XNUMX_XNUMX.JPG
      (Abalahlekile abangu-4443 no-4444 basuswe ngekhamera, owokugcina ngu-4445).

      Bese ngithi ngisebenzisa iskripthi ngomhla ka-01/04/13 futhi nginezithombe ezintsha ekhadini. Isikripthi sakha umkhombandlela obizwa nge-13.04.01 nangaphakathi kwezithombe / amavidiyo amasha ogama lawo likhulu kune- "4445"; ngoba ifunda umkhombandlela we-13.03.10 futhi isithombe sokugcina ngu-100_4445.JPG. Uma ngiphinda ngihlanganisa iskripthi ngemifanekiso emisha evela ekhadini ngalolo suku olufanayo, zengezwa enkombeni engu-13.04.01. Akukho okubhalwe ngaphezulu.

      Ngiyethemba ngiwucacisile umbono wami kancane 🙂

  3.   Manuti kusho

    Futhi awazi i-Rapid Photo Downloader? Ngicabanga ukuthi kwenza konke lokho nokuningi.

    1.    Mnu kusho

      Iqiniso ukuthi le ndoda ezacile ibizenzela yona, ibizozijabulisa ngicabanga ukuthi futhi ingakhonza omunye umuntu

    2.    Joaquin kusho

      Sawubona. Bengingayazi futhi kubukeka kukuhle engikubonile ku-inthanethi, kepha empeleni iskripthi sikufeza kahle engikudingayo; okuwukufaka ikhadi futhi wonke amafayela akopishwe ngokuzenzakalela.

      Kungisizile nokuthi ngifunde okwengeziwe ngoba kusobala ukuthi bekungasebenzi okokuqala; Amaphutha enzekile futhi kuningi okufundwayo kubo.

      Bengingahlosile ukukhombisa iskripthi ukuxazulula izinkinga zabanye, kunezinhlelo zokusebenza ezifana nalezi ozishoyo ezijwayelekile kakhulu. Ngabelane ngayo nawe ukuthi uyifunde futhi njengesithenjwa sokwakha izinto ezintsha ezisebenzisa amaluphu (kulokhu "kwe") nezinkulumo ezijwayelekile (okuguquguqukayo "ULTIMG" ne- "FILTER" kusikripthi)

  4.   ikhodi kusho

    Kubukeka kuwusizo, ngiyakugcina uma kwenzeka ngikudinga ngolunye usuku. Ngiyabonga.

    1.    Joaquin kusho

      Gracias!

  5.   engaziwa kusho

    kepha ngalokho sesivele sine-grsync

    1.    Joaquin kusho

      Yebo, kepha ngicabanga ukuthi i-rsync isetshenziselwa kakhulu izipele. Angikaze ngiyibheke kepha kuyisicelo okufanele sisicabangele futhi sifunde kithina sonke.

      Bengingazi ukuthi kukhona isikhombimsebenzisi sokuqhafaza se-rsync.

  6.   khumbuzile kusho

    Wow, ngithola ikhodi ithakazelisa kakhulu, ilusizo kakhulu. Qhubeka nomsebenzi omuhle. 😀
    Ngizoyigcina uma kungenzeka ngiyidinge.

    Ukubingelela

    1.    Joaquin kusho

      Ngiyabonga!.