Jump to content

delete file in Windows


This topic is 3785 days old. Please don't post here. Open a new topic instead.

Recommended Posts

HI,

Ik want to delete a file from FileMaker in Windows.

I want to send a event from FileMaker to do that.

From the commandprompt I type:

cmd/c del C:\Users\Tol\Desktop\File.csv

and that works, when I put this in the textbox for the event I get errors and it does'nt work.

How do I put this in the event textbox to get it working? can I use a Filemaker field or variable??

Link to comment
Share on other sites

There's an old trick for deleting files. Simply export a zero found set using the path to the file, and it'll be deleted.

Do you also know how to do it via "send event"???

It must be possible with the command in my example command, I think my problem is that maybe I have to put some quote's, but I don't know where to put them.

FileMakerHelp is no help..

Link to comment
Share on other sites

  • 2 weeks later...

it's absolutely possible and you're very close. You need quotes around the path and the file name. So it would look like this:

cmd /c del "C:\Users\Tol\Desktop\File.csv"

also note the space between 'cmd' and '/c'

Link to comment
Share on other sites

  • 5 months later...

You could use a plug-in. Have a look at the BaseElements plugin which you can find here. http://www.goya.com....elements/plugin

It is open source and free.

The function BE_ListFilesInFolder ( path {; type } ) will get you all the files in the folder you specify in <path> into a return separated list.

BE_DeleteFile ( path ) will allow you to delete the file at <path>.

If you need the file creation dates so you can determine which files are more than 30 days old, you could use the function

BE_ExecuteShellCommand ( command {; waitForResponse } ) and execute the command line DIR function for the folder.

This returns the standard command line response to the DIR command which might look somethinglike this.

Volume in drive C is OS

Volume Serial Number is 5809-E1FA

Directory of C:Usersbrian.rich360Works

15/11/2011 15:26 <DIR> .

15/11/2011 15:26 <DIR> ..

15/11/2011 17:02 12,467 360Plugins_FMAdvanced.log

15/11/2011 15:26 0 360Plugins_FMAdvanced.log.lck

10/10/2011 07:43 28,826 360Plugins_Runtime.log

10/10/2011 07:42 0 360Plugins_Runtime.log.lck

07/11/2011 13:44 157,909 360Plugins_WPE.log

07/11/2011 13:43 0 360Plugins_WPE.log.lck

16/11/2011 09:28 362,505 miscellaneous.log

7 File(s) 561,707 bytes

2 Dir(s) 107,413,880,832 bytes free

(This should line up in columns but the post view doesn't show this properly - sorry)

The creation date is in the first column and the file name is at the end. You'll need to process the response to get out the information you want, but this should be a straightforward parsing exercise.

HTH

Brian

Link to comment
Share on other sites

  • 4 weeks later...

plugins can do this easily. You can also do it without a plugin by using a VBscript stored in a container field (or generated as text based on your parameters) and exported out (Export Field Contents script step) and then fired by a Send Event script step.

VBscripts pack more power than command lines or batch files and are more intuitive to write than complex batch files.

Link to comment
Share on other sites

  • 1 year later...

it's absolutely possible and you're very close. You need quotes around the path and the file name. So it would look like this:

cmd /c del "C:UsersTolDesktopFile.csv"

also note the space between 'cmd' and '/c'

this worked perfect for me - i am wondering if it's possible to do something similar with FM Go as well.

Link to comment
Share on other sites

This topic is 3785 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.