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 

2 Answers

As the unzip(1l) man page states, pass -o to unzip in order to force overwriting of existing files without prompting.

1

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.)

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like