V
V
Vitaliy2017-12-06 20:59:55
Lua
Vitaliy, 2017-12-06 20:59:55

How to make the console version of 7zip unpack a file consisting of a pathname in lua?

path_e = 'C:\\7-Zip\\7z.exe e '
my_file = 'C:\\test\\123.docx'
dir = 'C:\\test\\112233'
os.execute(path_e.. my_file..' -o'..dir)
In this form, everything is processed correctly.
But if you change the file name to '12 3.docx' or '1 23.docx' (i.e. the file name consists of several groups of characters or numbers), then 7zip "writes" that the archive was not found.
I ask for help in issuing a command to unpack a file of the form: "this is such a long file.docx"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
ElijahTr, 2017-12-07
@ElijahTr

Wrap in quotes? :)
https://repl.it/repls/StandardRealisticGoldfinch

V
Vitaliy, 2017-12-07
@Vitaliy_dzen

Yes, it was necessary to wrap it in quotes, i.e. escape from both sides '"' my_file, thanks to ElijahTr for the direction of thought, the code below works:
os.execute(path_e.. '"' .. my_file.. '"' ..' -o'..dir)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question