Quick question: recursive touch?

Timothy R Evans tre17 at pc142.cosc.canterbury.ac.nz
Tue Oct 5 22:22:06 EDT 1999


"Malcolm Tredinnick" <malcolmt at smart.net.au> writes:

> On Tue, Oct 05, 1999 at 09:21:28PM +0000, Blake Winton wrote:
> > On Tue, 05 Oct 1999 20:51:25 GMT, Preston Landers wrote:
> [ ...random deletions... ]
> 
> > >> 'open(file,"w")' will cause the file to become zero bytes long.
> > >
> > >Isn't that what touch does?
> > 
> > Nope.  touch only changes the time if the file already exists...
> 
> I guess it depends on the version of touch you are using. By default,
> the GNU version *does* create a file of zero length if it doesn't
> previously exist. This is a documented faeture. If you don't want this
> to happen, you must pass the -c or --no-create option.
> 
> Cheers,
> Malcolm Tredinnick

Yes, but open(file,"w") will *delete* the current file and replace it
by a file with 0 length.  This is not what you want.

--
Tim Evans





More information about the Python-list mailing list