![]() ![]() ![]() REM Zip all files and folders echo Getting time. ![]() "%SevenZip%" a -pYourPassword -tzip "%DestZip%" -r "%BaseDir%\*.*" This is the point where you can add -p option. Last line of this batch file is responsible to execute 7z command line. It would have been easier for you if batch file was formatted properly. Set TimeStamp=%Year%%Month%%Day%_%Hour%%Minute%%Second%įor %%a in ("%DestZip%") do (set DestZip=%%~dpna-%TimeStamp%%%~xa) Set SevenZip=C:\Program Files\7-Zip\7z.exeįor /f "tokens=1-9" %%a in ('wmic.exe Path Win32_LocalTime Get Day^,DayOfWeek^,Hour^,Minute^,Month^,Quarter^,Second^,WeekInMonth^,Year ^| find /v ""') do ( Set DestZip=D:\Destinationtest\BACKUP.zip Any idea where do I put the -p command to make it work? I tried but it is not working for me. I'm not certain if there's an easy way around this.I have a script below which is working perfectly, all I need is to add a password & encryption while compressing. Including the password as a command-line argument is relatively unsafe: users on the same host (if a multi-user system) can see the password in clear text by looking at the process list.Or, assuming you have Rtools installed, you can use its unzip as above without relying on WinZip. I don't know if it supports extracting a file to stdout, so you might need to explore its command-line options for that, and if not then work out storing the document to a temporary directory. It does support passwords, I believe it uses the -s argument instead of -P. WinZip does support a command-line interface, so we should be able to use it within pipe (or system or similar). Read.csv(pipe("unzip -q -P secretpassword -c files.zip file2.csv")) In R, readLines(pipe("unzip -q -P secretpassword -c files.zip file1.txt")) Okay, now we have a password-protected zip file. Length Method Size Cmpr Date Time CRC-32 Nameġ2 Stored 12 0% 10:03 af083b2d file1.txtġ0 Stored 10 0% 10:03 1c1d572e file2.csv $ c:/rtools42/usr/bin/zip.exe -P secretpassword files.zip file1.txt file2.txt (Or perhaps you can use unzip included with Rtools.) I don't have WinZip, but since both it and unzip.exe (within Rtools-4.2) support password-encoding, then we should be able to use similar methods. ![]() I have tried looking at Expand-Archive in PowerShell and trying to call that through R but am not having much luck, please someone help me!Įxception calling "ExtractToFile" with "3" argument(s): "The archive entry was compressed using an unsupported compression method." Read_xml(unz("file.xml", ""))Įrror in nnection(x, "rb") : cannot open the connection In addition: Warning message: In nnection(x, "rb") : cannot open zip file 'file.xml' Reading without unzipping (get "error reading from the connection) - Extract files from password protected zip folder in R Using 7-Zip (I can't access this) - Unzip a password protected file with Powershell Warning message: In unzip(zipfile = "") : zip file is corruptĪnd the file is not corrupt as I can manually unzip it fine afterwards. Using unzip does not support passwords - unzip a. I have found these that I can't see what I need to do: I need to automate the collation of this data, my thinking is unzip then read. I have a file that is zipped and contains a single XML file. I have searched far and wide here but cannot find a post that satisfies the question. My organisation doesn't have access to it, we use WinZip for everything. I am trying to use R to unzip password protected files from a drive without using 7-zip. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |