Quick question: recursive touch?

Charles G Waldman cgw at fnal.gov
Wed Oct 6 09:03:37 EDT 1999


Malcolm Tredinnick 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.

That wasn't the point; the problem with the posted Python code was
that if the file *did* exist, it would be truncated, losing any
existing data.




More information about the Python-list mailing list