DGA4130/DGA4132 creare un archivio con TAR escludendo un file ?

  • 6 Risposte
  • 4718 Visite

0 Utenti e 1 Visitatore stanno visualizzando questo topic.

Offline shdf

  • Esperto
  • ****
  • 981
  • Sesso: Maschio
Ciao,
chi arriva a fare un archivio con tar escludendo un file o una cartella ?
Codice: [Seleziona]
root@modemtim:~# tar
BusyBox v1.23.2 (2017-11-01 03:43:39 UTC) multi-call binary.

Usage: tar -[cxtzhvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]...

Create, extract, or list files from a tar file

Operation:
        c       Create
        x       Extract
        t       List
        f       Name of TARFILE ('-' for stdin/out)
        C       Change to DIR before operation
        v       Verbose
        z       (De)compress using gzip
        O       Extract to stdout
        h       Follow symlinks
        X       File with names to exclude
        T       File with names to include

root@modemtim:~#
il comando seguente non sembra funzionare  >:( non arrivo a escludere la cartella /www/docroot/aria
Codice: [Seleziona]
tar -zcv -X /www/docroot/aria -T backup.tar.gz -f /www/docroot/
« Ultima modifica: 18 Febbraio 2018, 18:31 da shdf »
Scusa, sono francese non parlo molto bene italiano
DGA4130 sbloccato firmware 2.2.0 + GUI TIM Unlocked
DGA4132 sbloccato firmware 2.2.0 + GUI TIM Unlocked

Offline MisterFTTH

  • Global Moderator
  • Esperto
  • *****
  • 949
  • Sesso: Maschio
Re:DGA4130/DGA4132 creare un archivio con TAR escludendo un file ?
« Risposta #1 il: 18 Febbraio 2018, 18:44 »
Prova con l'opzione --exclude=dir

tar cpzvf backup.tar.gz /www/docroot/ --exclude=aria
Netiquette del Forum

Offline shdf

  • Esperto
  • ****
  • 981
  • Sesso: Maschio
Re:DGA4130/DGA4132 creare un archivio con TAR escludendo un file ?
« Risposta #2 il: 18 Febbraio 2018, 19:42 »
ho gia provato, mi da un errore, non conosce --exclude  :(

ho visto che si puo mettere la lista delle cartelle che vogliamo scompattare in un file, stessa cosa per escludere delle file...ma non funziona :

Codice: [Seleziona]
root@modemtim:/# tar -cvzf GUI.tar.gz -T /root/list.txt
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
...
Scusa, sono francese non parlo molto bene italiano
DGA4130 sbloccato firmware 2.2.0 + GUI TIM Unlocked
DGA4132 sbloccato firmware 2.2.0 + GUI TIM Unlocked

Offline MisterFTTH

  • Global Moderator
  • Esperto
  • *****
  • 949
  • Sesso: Maschio
Re:DGA4130/DGA4132 creare un archivio con TAR escludendo un file ?
« Risposta #3 il: 18 Febbraio 2018, 21:26 »
In effetti l'opzione da me segnalata non è presente in questo caso, ma nella tua ultima prova mi sa che hai fatto un po' di confusione: l'opzione è X e funziona direi bene!

Codice: [Seleziona]
root@OpenWrt:/tmp# mkdir -p test/1
root@OpenWrt:/tmp# mkdir test/2
root@OpenWrt:/tmp# touch test/2/test.file
root@OpenWrt:/tmp# echo 1 > list.txt
root@OpenWrt:/tmp# cat list.txt
1
root@OpenWrt:/tmp# tar cvf test.tar test/ -X list.txt
test/
test/2/
test/2/test.file
root@OpenWrt:/tmp#
Netiquette del Forum

Offline shdf

  • Esperto
  • ****
  • 981
  • Sesso: Maschio
Re:DGA4130/DGA4132 creare un archivio con TAR escludendo un file ?
« Risposta #4 il: 18 Febbraio 2018, 21:36 »
ho capito il mio problema, i file creati dal mio notepad++ non piace al systema...ho creto il file direttamente su nano è ora va bene...ma ho un altro problema, non si puo usare il * nella lista ?!
Citazione
tar: /usr/lib/opkg/info/libopenssl*: No such file or directory

per esempio :
/usr/lib/opkg/info/libopenssl*
per prendere tutti file che cominciano con libopenssl
« Ultima modifica: 18 Febbraio 2018, 21:39 da shdf »
Scusa, sono francese non parlo molto bene italiano
DGA4130 sbloccato firmware 2.2.0 + GUI TIM Unlocked
DGA4132 sbloccato firmware 2.2.0 + GUI TIM Unlocked

Offline MisterFTTH

  • Global Moderator
  • Esperto
  • *****
  • 949
  • Sesso: Maschio
Re:DGA4130/DGA4132 creare un archivio con TAR escludendo un file ?
« Risposta #5 il: 18 Febbraio 2018, 21:46 »
Nel tuo esempio precedente era proprio sbagliata la sintassi eh  :P comunque Notepad++ impostalo come Unix/UTF-8-BOM e sei a posto.

Riguardo l'altro problema, potresti banalmente generare in anticipo la lista di esclusioni o inclusioni:

ls /usr/lib/opkg/info/libopenssl* > list
Netiquette del Forum

Offline shdf

  • Esperto
  • ****
  • 981
  • Sesso: Maschio
Re:DGA4130/DGA4132 creare un archivio con TAR escludendo un file ?
« Risposta #6 il: 18 Febbraio 2018, 22:03 »
grazie !
Scusa, sono francese non parlo molto bene italiano
DGA4130 sbloccato firmware 2.2.0 + GUI TIM Unlocked
DGA4132 sbloccato firmware 2.2.0 + GUI TIM Unlocked