Editing Google Docs Files Through Batch File - file

Is it possible to edit a text file (*.txt) that's public for editing in google Docs through Cmd or a batch file. Or Can I use the FTP Command? It can even be done by uploading and downloading the same file (Download, Edit, Upload).
I have made the Document That I want to add text to and re-upload it per say. https://drive.google.com/file/d/0B0qbLnCcNlcMQ1VSQkFoSmJxc1k/view?usp=sharing

As well as the ftp side goes, afaik google docs don't support ftp access
But a 3rd party program called Cyberduck comes handy at this point
So passing some arguments to cyberduck might do the trick
But if you also want to access a 3rd party ftp server
than it is also possible using the ftp command

Related

Access files on website (http) similar to ftp

We have an issue with a FTP site that fails intermittently. Upon notification that a connection cannot be established we manually log into a website and upload our file. We have no idea why the FTP site fails and it is not under our control. This community has some good ideas so I am asking if a website (http) can be logged into programmatically and files can be uploaded to or downloaded from that website in a manner similar to ftp. No API available from this vendor.
You did not give specifics about your environment or how you wish to implement your uploads. There are many tools available on most platforms to programmatically upload files, so I'll just mention a few general tips.
There is a very useful Linux GNU shell utility, wget: https://www.gnu.org/software/wget/, that has been available for a very long time. This utility has a command line interface which can easily be accessed programmatically from scripts using exec or other shell commands, to upload files via HTTP and FTP.
It's not as common, but there is a corresponding utility, wput: http://wput.sourceforge.net/, that is used to upload files.
If you only have access to Windows computers, a similar functionality is available from the Windows PowerShell (it's built in). Here is an old SO post with examples of how to do it with PowerShell: How to script FTP upload and download?
Another Windows based utility is WINSCP: https://winscp.net/eng/docs/guide_automation.
In answer to your question, these utilities wget/wput, PowerShell, and WINSCP, could be used to programmatically upload and download files to your FTP site. You could write (or have written) a custom script that automatically retries in the event that you get failures from your flaky FTP site.

Overwrting multiple file using NSIS Script (how Win Zip extractor does)

I am writing a script using Null Script which install around 6000 files in INSTALLDIR i.e. C:\ABC folder.
I have done this using
File /r "ABC"
in install section.
It is just a simple extractor (no registry entries and no uninstall.exe created during install).
Now, if I run the same exe again then I want my exe to display a message box to the user while overwriting the files containing the options
Yes,
Yes too all, or
exit the installer
i.e. How WinZip software does while extracting the same zip file in the same location multiple times.
If I set the SetOverwrite value to off then during install (2nd time) my EXE just skips the file installation without notifying the user. Also using IFFILEEXIST I can check a single file or *.* files but cannot do one to one mapping.
Please suggest how can I implement this. If this question is already posted then please send me the link.
Thanks in advance.
It is not possible to get this behavior in NSIS when using File /r. You might be able to pull off something similar by generating the file list at compile time by executing a batch file with !system and then check if each file exists and maybe delete the old one at run-time but you are not going to get the dialog without a custom plugin. NSIS itself only supports basic Abort/Retry/Cancel and Yes/No dialogs.
If you only want to use free tools, why not just use 7-Zip to create a self extracting archive?

Need a batch file to check the contents of an online text file

My business has been putting out a lot of software, but I'd like to implement a program that checks for updates of our software so our clients are alerted and can then upgrade.
I was thinking of adding a text file on our servers that would display either 0 (no update available) or 1 (update available!) that a batch could read and copy out to a local file.
So I've now uploaded a file (check.txt) that contains just the number '1' and placed on my server. And that's where I've got stuck...
After searching the net, all I could come up with is the following for a batch file:
http://www.mysite/updates/check.txt > update_available.txt
Now, I'm sure I've done something wrong here, as all I'm getting is a blank .txt file.
I'm sure I've missed something crucial here, but despite my searching of the interweb, I simply can't find a solution.
Any ideas?
Below solution cmay be weird, I've had a similar requirement in the task and I used to do the below. I couldn't find any other solution without any 3rd party tools and especially in a proxy environment.
Create a browser shortcut using chrome or just type the below code in a note pad file and save it as myfiledownload.url
[InternetShortcut]
URL=http://www.mysite/updates/check.txt
Make sure that your chrome is your default browser & chrome settings are set to download the files automatically to a path say C:\downloads\
Just use the below lines in your batch. It opens the browser (chrome) and downloads the file to your default download location and you can move it to some other location and do whatever you want. Use the timeout command to give some to open the browser and download the file.
-
#echo off
C:\downloads\myfiledownload.url
timeout /T 10 /nobreak
move c:\downloads\check.txt d:\test\whatever.txt
Cheers.
G
:: Get details. Note - options are case-sensitive!
wget -O %workdir%\update_available.txt http://www.mysite/updates/check.txt >NUL 2>NUL
WGET is a free GNU utility, just Google "wget"

psftp.exe get files from the server and delete

I'm using psftp.exe to download files from the server. Is there an easy way to delete these files once I have downloaded them but leave the new ones that might have appeared on the server when I was downloading to be downloaded next time?
Here's my command line:
psftp.exe domain.com -i keys\private.ppk
get *.xml
Edit: I want to download the files from a Linux box to a Windows PC.
There's no easy way to do this with psftp. You would have to parse its output to find files that were successfully downloaded.
Though you can do this easily with WinSCP. Just use get -delete *.xml command.
Full WinSCP script would be:
open sftp://domain.com/ -privatekey=keys\private.ppk -hostkey=...
get -delete *.xml
exit
See an introduction to WinSCP scripting.
See also a guide for converting PSFTP script to WinSCP.
You can also have WinSCP GUI generate script like this for you.
(I'm the author of WinSCP)
Martin's answer is good. The below is more industrial.
Moving them to a staging area before the download may be prudent.
Generally you would move/rename the files on the server as a starting point. They are going to be deleted anyway so nothing should miss them? nor would you want to fall back over a recent file.
(so restart after this point in the event of a subsequent failure)
Then perform the download.
Then perform the delete.
I would approach the issue differently. Instead of deleting the file from the server, add the downloaded filename to a local table of "Already downloaded files". Then when you scan the FTP again for new files, ignore any that are in that table.
That way the next time you run your download script you only get the new files, but the old files remain on the server.
You could have another script that runs periodically and deletes all files over a certain age.
WINSCP is alright, and Martin (the author) drops in to practically every PuTTy thread to recommend it, but it's a fully GUI-based app and not for me. If you really need everything to be done on the commandline then WINSCP is often not an option.

Script to Specify the FTP File Path

Anyone know if I can specify the file path for an FTP upload or script it if there isnt an FTP option to do this in a program? I'm using ScreenPresso Screenshot Software but the FTP Upload doesnt have an option to send it to a certain file path but there is a Scripting option that the program supports. I have no idea what coding is used. Any ideas?
when you specify your ftp address include the subfolders as well as
ftp://foo/bar/baz/qux
Other than that you could try asking their support.

Resources