Jump to content

Clear content of a file


Recommended Posts

Hello,

I want to clear a logfile after a certain step of a script.

I don't want to delete the whole file, but I want to clear the content, that the txt-file is empty...

Is there any command like clear file or something like that?

Tanks...

Link to comment
Share on other sites

$file = FileOpen ( "filename", 2 )
FileClose($file)

Should to the job. Excerpt from the help file:

Mode (read or write) to open the file in.

Can be a combination of the following:

0 = Read mode

1 = Write mode (append to end of file)

2 = Write mode (erase previous contents)

Hope this helps

Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...