Post by Admin on Nov 20, 2023 20:40:33 GMT
Windows 10 has a built in tar.exe that works very much like the Linux tar
Earlier versions of Windows do not have tar.exe, but I believe it can be installed if desired.
I've been playing around with it and came up with a couple of uses.
1.) Zip up everything in DefaultDir$, and place the resulting .zip file in DefaultDir$
2.) Unzip a .zip file residing in DefaultDir$ to DefaultDir$
1. eg: can come in handy when making an installer or adding downloaded files to a project
2. eg: can be used after downloading a .zip file(using curl) to DefaultDir$
Since tar.exe is not an internal shell command there is no need to start it up using cmd.exe, but RUN lines with cmd.exe were left in to show it works too.
Earlier versions of Windows do not have tar.exe, but I believe it can be installed if desired.
I've been playing around with it and came up with a couple of uses.
1.) Zip up everything in DefaultDir$, and place the resulting .zip file in DefaultDir$
2.) Unzip a .zip file residing in DefaultDir$ to DefaultDir$
1. eg: can come in handy when making an installer or adding downloaded files to a project
2. eg: can be used after downloading a .zip file(using curl) to DefaultDir$
Since tar.exe is not an internal shell command there is no need to start it up using cmd.exe, but RUN lines with cmd.exe were left in to show it works too.
'xxgeek 2023
NOTE: SAVE this to it's own Folder before RUNing.
'zip or unzip files to or from DefaultDir$ using tar.exe
'xxgeek Nov 2023
'tar.exe is built into Windows 10+, I believe it may be downloaded for earlier versions.
'User must provide any zip files used for extraction.
'zipFile.zip can be any .zip file the user wishes that resides in DefaultDir$
nomainwin
'example #1
'zip all files and subfolders/files in DefaultDir$ into a file named 'newFile.zip'
'run ONE of the following, they all do the same thing
newFile$ = "newFile.zip"
run "tar.exe -a -c -f ";newFile$;" *.*",hide 'uses a variable with tar (recommended)
'or
'run "tar.exe -a -c -f newFile.zip *.*",hide 'uses a literal with tar
'or
'run "cmd.exe /c tar -a -c -f newFile.zip *.*",hide 'uses a literal with cmd and tar
'or
'run "cmd.exe /c tar -a -c -f ";newFile$;" *.*",hide 'uses a variable with cmd and tar
end
'#################
'example #2
'(user supplies zipFile.zip or changes name to an existing .zip file in DefaultDir$)
'unzip any .zip file(in DefaultDir$) into DefaultDir$
' - (DefaultDir$= the folder this code's file is RUNing from)
'run one of the following (zipFile.zip can be replaced by a variable here as well)
zipFile$ = "zipFile.zip"
'run "tar.exe -x -f ";zipFile$,hide ' uses variable (recommended)
'or
'run "tar.exe -x -f zipFile.zip",hide 'uses literal
'or
'run "cmd.exe /c tar.exe -x -f ";zipFile$,hide 'uses variable
'or
'run "cmd.exe /c tar.exe -x -f zipFile.zip",hide
'end