Pydrive deleting file from Google Drive
<p>IÂ´m writing a small script in python 3.5.2 with pydrive 1.2.1 and I need to be able to delete a file which is not stored locally in my computer, but in my account of Google Drive. The <a href="http://pythonhosted.org/PyDrive/filemanagement.html#delete-trash-and-un-trash-files" rel="nofollow">docs</a> only show how to delete a file you previously created, not one which is already stored on the drive. Is deleting an existing file actually possible with pydrive? if so, how? </p>

<p>From the docs seems that <code>drive.CreateFile()</code> create only a reference to a file, this can be local or remote.
As you can se <a href="http://pythonhosted.org/PyDrive/filemanagement.html#download-file-content" rel="nofollow">here</a> <code>drive.CreateFile()</code> is used to download a remote file.</p>

<p>I believe that something like this should do the job:</p>

<pre><code># Initialize GoogleDriveFile instance with file id.
file1 = drive.CreateFile({'id': &lt;file-id&gt;})

file1.Trash()  # Move file to trash.
file1.UnTrash()  # Move file out of trash.
file1.Delete()  # Permanently delete the file.
</code></pre>

python pydrive