How to get a notification when user deletes a file? - google-drive-api

Is there a way to get a notification (like a state with "delete" action and file id) when the user deletes a file of my app on drive?
Thanks,
Daniel

There is no notification right now, but if you look at the Changes for an account, there will be an entry with deleted field set to true with the File ID for the deleted file.

I don't have a knowleges in Google-drive-sdk, but I have already create a similar function in php:
With a CRON ( php script running in background task) I list files in my folder, and I compare with a database ( I add a filename, size file, in database when user add file) , if file exist in database, and not exist in my list, user delete this file and I want send a notification...
until a person expert on "Google-drive" you find a solution, I hope mine will come in handy.

Related

Chrome app create and write to file

I am attempting to use chrome.apps for a program that needs to write multiple separate log files of data. The user then needs to be able to access these these log files outside of the app in their file system for post processing.
This will need to be done many times so minimum to no user interaction would be desired for file generation. While this is simple in any native program code, I've been finding this very difficult to do with chrome apps.
E.g. can I use chrome apps to create "log_file.txt" & "log_file2.txt" without user interaction?
Is there any way I can have the user just specify a directory then from my app, I would be able to create multiple files within that directory without user interaction?
I've tried to do this in code but I need "entry" handles for the chrome.filesystem. The "getEntry" method requires an "entry" so it seems impossible to create new "entry"s such that I can write to new files.
Any ideas would be appreciated!
Is there any way I can have the user just specify a directory then from my app, I would be able to create multiple files within that directory without user interaction?
Yes. You need to request a directory with
chrome.fileSystem.chooseEntry({type: "openDirectory"}, /*...*/);
As long as you have the permissions
{"fileSystem": ["write", "retainEntries", "directory"]}
you will be able to create files in that directory, and "retain" (save) the directory entry for later reuse without asking the user again. Creating the files once you have a DirectoryEntry should be similar to this.
But that minimum of interaction (asking for the folder initially) is required.

Infusionsoft File Box - Delete File

I am new to the infusionsoft API and I am attempting to maintain some files in a Contacts' File Box...
According to the API documentation:
https://developer.infusionsoft.com/docs/read/File_Service
I can ADD a file
I can RENAME a file
I can REPLACE a file
There appears to be no way of deleting a file or getting a list of files with their details..
I want to be able to replace or delete previous file and upload a new one.
Does anyone know a way of doing this?
Thanks
Welcome to the wonderful world of the data service and interacting with tables! Specifically, you're going to want to use DataService.delete to delete the file in the database. You can also use DataService.query to get File details.
Here's an example for deleting a file, via the PHP SDK:
$file_id = 123;
$deleted = $app->dsDelete( 'FileBox', $file_id );
That's it! You can do a LOT with the Data Service.
EDIT: It looks like the FileBox table only allows Read access...Silly. Completely deleting the file via the API appears to be impossible. Gold Star, InfusionSoft.
An alternative for "deleting" a file would be to replace the file contents with an empty string. Something like:
$file_id = 123;
$deleted = $app->replaceFile( $file_id, '');
Note that this won't actually delete the file entry from the table...
There isn't a way of deleting files from the FileBox via the API. This was done intentionally to prevent files from accidentally being deleted.

Send Email as attachment then delete

I have an SSIS package where I am generating a file and sending it to a user, that works all well. however, they want the date in the file name, and I don't want to have a bunch of old daily files sitting in my directory, so I try to delete the file after sending (all of this is done is a script task).
System.IO.File.Delete(DestinationName);
Now, the problem is, I get an error saying it can't delete because the file is in use by another process (the sending of the email) so I thought to make it wait a bit:
//wait a minute before deleting
System.Threading.Thread.Sleep(60000);
System.IO.File.Delete(DestinationName);
By this time I have recieved the email, however, the process is still holding on to the file. How do I get the email to let go? Do i need to put this in its own Script Task?
Thanks

How to BULK INSERT files that change name every day?

I have a folder that is static with a daily txt file that goes into the folder. The file name is the date. If the file name has the same name every day, everything works. Is there a way I can have my script pull any txt file in the folder? (Note, file comes in, get's processed and then I have an automatic transfer that moves the file after it has been inserted to a processed folder). So there will only be one file at a time in the folder. I hope that makes sense.
Here is the script for the bulk insert:
Bulk Insert Mydata.dbo.cust_adj
From 'C:\MyData\FlatFiles\UnprocessedAdjReport\importformat.txt'
With
(
FieldTerminator= '|',
Rowterminator= '\n'
)
Go
(I've got this saved as a stored procedure btw)
So "importformat" is just the name I used while setting up my scripts, going forward it will be in bb-yyyy-mmdd-hhmmnnnn.txt, as soon as the file is inserted, I move the file from the unprocessed folder to the processed folder. There will only be the one file each day.
If anyone has any advice or assistance with this, I would greatly appreciate it.
See the link it may be what you are looking for:
http://www.kodyaz.com/articles/how-to-extract-filename-from-path-using-sql-functions.aspx
Or
http://sqljourney.wordpress.com/2010/06/08/get-list-of-files-from-a-windows-directory-to-sql-server/
Or maybe
http://www.codeproject.com/Articles/38850/An-Easy-Way-to-Get-a-File-Name-or-a-File-Extension
HTH

Href - File Name taken from mysql database

I currently have a form that uploads the data via PHP to a PDF form and that form is generated and saved on my ftp server. The data is also posted to a mysql database and the name of the file name for the pdf is the unique id of the mysql record (eg. 85124.pdf)
I would like to set up a link where the user can print the generated PDF file as a receipt but cannot figure out how to have the link call up the specific file for that specific record.
For example:
pdf - where the filename would be the same as the unique mysql id (eg. 85124). Is this possible?
I see that I may not have stated properly what I am trying to do and in what enviornment.
I have a page set up where users/clients can book their shipments online ( I work for a small shipping company). The user puts in their shipping adress and such and once they hit the submit button the following happens:
The data is sent to a mysql database on my host (godaddy) and the table is populated with that specific record. The unique id becomes the tracking number for the shipment.
$tracking=mysql_insert_id;
The data is also sent as a FDF file to my ftp and stored in a folder. The name of the FTP is determined by what the the tracking number is after it is put into the mysql database.
$fdf_file=$tracking().'.fdf';
$fdf_dir=dirname(__FILE__).'/results';
The data is then placed into a PDF form that is on my ftp.
$pdf_doc='https://www.mysite.com/shipformrso.pdf';
On the screen after the form is submitted the client receives a confirmation that their from was completed properly and they are given their tracking number.
echo "<font color='red' size='+1'><b>" . 'Your tracking number is '.$tracking() . '. <n\> PLEASE PROCEED TO THE SERVICE DESK TO RECOVER YOUR LABELS.' ."</b></font>";
What I would like to do is have another link where the user can click on and have the browser open up the FDF/PDF file was generated for their specific shipment. This is where I have the problem. I can't seem to figure out how to create the link specific file that was just generated.
Thanks for any help.
As much as I understand, you don't want to show the pdf printing link to your users? At least, the id of the pdf file, which is plainly holded in the db? Then, you can hash your id, POST it to the server and decrypt it on server side then proceed to pdf showing/printing page. In this way no user can understand the hash data, and how to decrypt it. Only your server side script does.;)
For ex:
When user enters here:
blabla.com/?id=SOME_HASHED_VALUE
On the server side:
You decrypt it, and make the SOME_HASHED_VALUE to look like this: 45869 - which is the unique id holded in the db. And then proceed normal flow. ;)