Save files with specific extension using aria2 - download

PROBLEM: I was using a Google Colab based downloader using Aria2 to download certain files to Google Drive. The problem is downloaded files have no extension, and are being treated by Drive as binary files, even after renaming the downloaded file with its extension. Also, I couldn't find another aria2 downloader which can do this.
If anyone could tell me how to modify the code...

You can make your own code, I'll show you.
First install Aria2 using this command
%%capture
! sudo apt-get install aria2
Then you'll have to link your google drive (using rclone or command method, whichever one you prefer)
! aria2c -x16 --summary-interval=5 -d "your destination path with the quotes" https://i.imgur.com/IR6BcQb.png
replace that image link with the link of your file.

Related

How to automate the download of latest jdk file using shell scripting from oracle

How to automate the download of latest jdk.exe file using shell scripting from oracle and convert to .zip file ?
https://www.oracle.com/java/technologies/downloads/#jdk18-windows
You can directly download the .zip format from the oracle website.
There is no need to convert it from .exe to .zip.
Also, it would be better if you could clarify what shell you need. Considering that youre looking for .exe, im guessing powershell? But who knows...
Im guessing you would just need to copy the download link and have the script grab it from there. For example with bash it would be like below:
#!/bin/bash
curl https://download.oracle.com/java/18/latest/jdk-18_windows-x64_bin.zip -o latest_jdk.zip
download zip file image

OSX One-step converting from ZIP to DMG via terminal?

Is there an elegant way of converting ZIP files to DMG?
I would avoid to expand the (many) files manually and then to repack'em to a DMG.
Could that be done via terminal, maybe in a single step?
There is an app called DropDMG that lets you convert between file types. The description on the website claims you go from .zip to a dmg file. The app is not free but they have a free trail available that may work for you.
A terminal command that might work is hdiutil.
hdiutil create -format UDZO -srcfolder folder_to_compress archive_name.dmg
I just tried this on a .zip file and it worked. But note that when I launch the .dmg file I just get the .zip file back.
You could also write a two line script. First line is to unzip the zip file and then use the hdiutil command to make a dmg from the expanded files.

Winzip command line error and message handling

I'm trying to automatically zip a group of files and move them to a different location.
This is the command i'm using for the script:
<WinzipPath> -a -r -en <Dest&Name>.zip <source>
Problem is that at any given moment one of the files is still being written, and when i try to zip it i get the following message which interrupts my automation:
Any idea on how do I ignore\skip the message via CMD? tried looking in the Winzip's Doc for more flags but couldn't find anything helpful
Another (smaller) issue is that when zipping for the first time after installing I get this message:
Can I skip that as well?
Are you using WinZip or WinZip Command-line Add-on?
You will do much better when scripting to use WZZIP which is installed after installing the command-line Add-on in the WinZip folder. NOTE: You must have WinZip Professional installed first.
http://winzip.com/downcl.html
Better yet, if you have the option to use 7-zip.. Understand if you have to use WinZip, but 7-zip handles large archives and more files within an archive better (IMHO). Also, I have previously asked about 7-zip having the ability to move a file to file and the Developer of 7-zip did respond: https://stackoverflow.com/a/21209385/175063
Try adding -min
<WinzipPath> -min -a -r -en <Dest&Name>.zip <source>
So you minimise the user interface, and it should not show message windows

Is it possible to make changes on Google Drive side by command line

Is it possible to access Google Drive by command line and do some changes to video/mp3 files?
Like for example I do to my local files for f in *.mp4; do echo $(ruby -e 'puts "name"') >> "$f"; done
Is it possible to connect to Google Drive and make all changes there without Downloading/Sync?
Right now I download files first to my PC, make changes and then upload files back to Google Drive.
Yes but you would need to write such command-line app using the google drive api. there is no official app to do that.
gdrive is a command-line utility to access a remote google drive account. Follow this example for a Linux machine to set this up:
At first download the execution file of gdrive here.
Decompress it and get the executable file gdrive. Now change the permissions of the file by executing the command
chmod +x gdrive.
Run ./gdrive about and you will get a URL asking you to enter for a verification code.
As instructed in the prompt copy the link and go to the URL on your browser, then log into your Google Drive account and grant permission. You will get some verification code at last. Copy it.
Go back to your previous terminal and paste the verification code you just copied. Then verify
your information there. Now you successfully link your machine to your Google Drive
account.
Now once done with the above process you can navigate the files on your drive using the commands mentioned below.
./gdrive list # List all files' information in your account
./gdrive list -q "name contains 'University'" # serch files by name
./gdrive download fileID # Download some file. You can find the fileID from the 'gdrive list' result.
./gdrive upload filename # Upload a local file to your google drive account.
./gdrive mkdir # Create new folder
Hopefully, it helps.

What does "download or create" mean in a tofrodos context?

I keep seeing this phrase "download or create" in tutorials right after tofrodos. What would be an example of how to download or create? I just get stuck in
^
^
^
mode.
apt-get -y install tofrodos
Download or create ZPX_ubuntu_12-04_auto_installer.sh
The author means you need to transfer the "ZPX_ubuntu_12-04_auto_installer.sh" shell script to the server, and if necessary, change to the directory you saved the script in using the cd command, before entering the commands below:
fromdos ZPX_ubuntu_12-04_auto_installer.sh
chmod +x ZPX_ubuntu_12-04_auto_installer.sh
./ZPX_ubuntu_12-04_auto_installer.sh
He seems to be referring to a particular script included in a .zip file posted on a web forum.
You may be able to download the .zip file to your computer, extract it, and then use the sftp or scp program to transfer just the shell script to the server. Alternatively, you could use wget or curl to download the .zip file to the server and then the unzip command to unzip it.
A graphical SFTP client like FileZilla may help for the former approach. The Firefox add-on cliget may help for the latter, especially because the file is hosted on a password-protected web forum.
fromdos is just a utility program to convert a text file from DOS/Windows format to Unix format by stripping out all the carriage return characters. Perhaps using this command is necessary because the author of the script used a Windows text editor or an ASCII-mode FTP transfer before zipping up the file. Of course, you need the file on the server if you are trying to run the command on the server.

Resources