1

I want encrypt this file with a default password programming in R. How can I do?

zip("C:/Users/user/Downloads/myarchive.zip", 
    files="C:/Users/user/Downloads/example.txt", 
    flags = "-r9X")

Thank you!!!

1 Answer 1

2
PASSWORD <- "BillMurray"

zip("C:/Users/user/Downloads/myarchive.zip", 
    files="C:/Users/user/Downloads/example.txt", 
    flags = paste("--password", PASSWORD))
2
  • zip("myarchive.zip", files, flags = "-r9XjP PASSWORD", extras = "", zip = Sys.getenv("R_ZIPCMD", "zip"))
    – SPS
    Commented Feb 22, 2018 at 16:33
  • The code mentioned was not working so I changed the 3rd line of code to below and worked for me. flags = paste0("-p", PASSWORD, " ", " a -tzip"),
    – Duffer
    Commented Nov 12, 2021 at 3:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.