Jump to content
Macro Express Forums

Emptying text files


Recommended Posts

Hi.. I suppose this is going to be an easy solution but I've not been able to find an answer yet. I have a program which scapes info from web pages and saves the info to various files in disk. Before I start I have to delete the older stored text inputs (about 25 files of various names) so that the new info can be stored satisfactorily.


There doesn't seem to be an "Empty File" option in my ME (v3.7d). Scrolling through the list of files isn't a problem but getting the existing info deleted is proving a problem.


I've tried a very simple


select all




series of text commands but the resultant "empty" files all have a blank first line!!


The new text saves all begin at line 2 and because of this my program doesn't work. :(


Any ideas how I can delete the text and start off with a pristine empty file with no blank top lines???


TIA :)

Link to comment
Share on other sites

Simply save an unused or "empty" text variable to the desired file (by "empty", I mean a variable whose value has been set to an empty string). You'll find this feature under Variable Modify String (which is a bit odd, since we're not modifying any strings!).

Link to comment
Share on other sites

Some ideas:


Would it work to delete the existing files? Try the Delete File or Files command.


How are you emptying the file? From your description it sounds like you may be writing a CR/LF when writing the empty string to the file. Look for an 'Add Trailing CR/LF' option and uncheck it.


Sometimes I need to start with a file that is almost empty. For example, I may want a line containing a header but no data lines. In these cases I create an 'HeaderOnly' file and copy it over the files that need to be emptied.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...