Unzipping files in unattended mode
When I use the unzip command from Linux machine and the files under ZIP already exists on my local directory, I get the interactive question: (if I want to replace the files from the ZIP with the existing files on my Linux machine
How to use the unzip command without this interactive question?
[@superuser]# ls -ltr
total 0
-rw-r--r-- 1 root root 0 Nov 15 15:13 all_my_files1
-rw-r--r-- 1 root root 0 Nov 15 15:13 all_my_files2
[@superuser]# unzip MY_FILES.zip
Archive: MY_FILES.zip
replace all_my_files1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
inflating: all_my_files1.txt
inflating: all_my_files2.txt
Solution 1:
As the unzip(1l)
man page states, pass -o
to unzip
in order to force overwriting of existing files without prompting.
Solution 2:
You want the -o
option:
unzip -o MY_FILES.zip
Source
overwrites existing files without prompting. This is a dangerous option, so use it with care. (It is often used with -f, however.)