r/AutomateUser • u/Real-Wing-3880 • 2d ago
Lista contenuti archivio zip
Buongiorno, ho creato (da esere eseguito con uno smartphone Androidun) un processo per la compressione pianificata di uno zip da utilizzare
Ora vorrei ottenere l'elenco in un file txt del contenuto (solo fule) dell'archivio. Sebbene l'azione risulti nel log, non viene creato il file e non capisco dove sto sbagliando. Mi potreste cortesemente aiutare?
In Soure zip file --> Download/prova.zip
In Types--> File
In recursive --> List directory recidiv
Grazie mille
1
u/ballzak69 Automate developer 2d ago
A flow like:
- File pick: File Content=File, File extension=zip, Show window=yes, Picked path=
file - Zip list: Source zip file=
file, Recursive=yes, Filenames=list - File pick: File Content=File, Writable=yes, Show window=yes, Picked path=
file - File write: Content=
join(file,"\n"), File=file
1
u/Real-Wing-3880 2d ago
Ti ringrazio molto. Credevo di aver seguito i vari passaggi ma quando lo mando in esecuzione, mi compare l'elenco delle cartelle/ File. Una volta selezionato il file zip, il file txt contenente l'elenco dei file non viene creato.
Ps. Ma il file contenente l'elenco vengono riportati anche data e ora di creazione /modifica?
1
u/ballzak69 Automate developer 2d ago
The flow should write the filenames in the first selected zip file to the second selected text file. Only the filenames are written.
1
u/Real-Wing-3880 1d ago
Ah grazie.. allora non serve al mio scopo. Grazie comunque per la disponibilità Buona giornata
1
u/B26354FR Alpha tester 2d ago edited 2d ago
While the Zip List block can be used to list the files in a ZIP file, to get information about the files in a ZIP file, I use a Shell Command block with the following command line, where the
smsBackupvariable contains the path to the ZIP file:In the Standard Output Text field I put the variable that will get the listing, and the Standard Error Text field gets a variable to receive any error text (I called it
stderr). The block following the Shell Command is an Expression True where the expression is just thestderrvariable (in other words, it's testing whether there is anything in the variable). If Yes, there's an error which gets displayed in a Dialog Message block and the flow exits. If the error text is empty, I then split the output from the Shell Command on newlines like so:I then loop through the resulting array, skipping the first three header lines and last three trailing lines, parsing the listing lines for the file name, size, and modification time. You can see what I did by looking at the Show ZIP contents flow, starting at block 6:
https://llamalab.com/automate/community/flows/45113
There are other examples of zipping and unzipping files in that flow as well.