Wie man einen Ordner in das odt-Format packt

1149
Denis

Ich extrahiere die .odt (Open Office) -Datei und mache einige Manipulationen daran. Und wenn ich die Datei zurückzippen möchte, habe ich ein Problem.

Zum Beispiel, wenn ich in das Verzeichnis mit entpackter odt-Datei gehe und so etwas mache:

cd /dir/with/uziped/odt zip -r ../test.odt . 

Alles funktioniert gut. Ich habe eine gültige Open Office-Datei und kann damit arbeiten.

Aber dann versuche ich zip von nicht root odt ordner Ich habe odt datei nach diesem Befehl beschädigt:

zip -r test.odt /dir/with/uziped/odt 

Also funktioniert es nicht.

"/ dir / with / uziped / odt" enthält einige Ordner und XML-Dateien

UPDATE :
Das Hauptproblem ist, was passiert, wenn ich versuche, einen Archivierer zu verwenden, nicht aus dem Stammverzeichnis, es nimmt alle Verzeichnisse im Pfad mit dem Befehl:

7z a -tzip tt.odt temp/* 

Die Ausgabe wird sein:

Compressing temp/Configurations2/accelerator/current.xml  Compressing temp/META-INF/manifest.xml  Compressing temp/Thumbnails/thumbnail.png  Compressing temp/content.xml  Compressing temp/manifest.rdf  Compressing temp/meta.xml  Compressing temp/mimetype  Compressing temp/settings.xml  Compressing temp/styles.xml 

aber ich muss das temporäre Verzeichnis nicht komprimieren. Ich muss nur alle Dateien aus diesem Verzeichnis wie folgt zu einem neuen Archiv hinzufügen:

Compressing Configurations2/accelerator/current.xml  Compressing META-INF/manifest.xml  Compressing Thumbnails/thumbnail.png  Compressing content.xml  Compressing manifest.rdf  Compressing meta.xml  Compressing mimetype  Compressing settings.xml  Compressing styles.xml  
0

1 Antwort auf die Frage

0
karel

Streaming input and output of zip

zip will also accept a single dash - as the zip file name, in which case it will write the zip file to standard output, allowing the output to be piped to another program.

For example the dd program can write the standard output to a file in another location. In the following example dd writes the standard output to a new file called test.zip (a zip archive) located on the user Denis's desktop.

cd /dir/with/uzipped/odt zip -r - . | dd of=/home/Denis/Desktop/test.zip 

The of that is typed after dd stands for output file. The . that comes after the single dash denotes the current directory.

Converting a zip file to odt

Because an .odt file is structured like a .zip file, you can view the contents of an .odt file by renaming the file's extension to .zip and then extracting the files from the zip archive. If you have preserved the directory structure of the original .odt file, you can convert the .zip file back to an .odt file after you have made changes to it by renaming the file's .zip extension back to .odt.

Alle Befehle sind bereits in Frage, os ist Linux Denis vor 8 Jahren 0
Ich brauche das für ein Python-Skript Denis vor 8 Jahren 0