Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!midway!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.shell Subject: Re: testing if a file is present Message-ID: <1990Nov28.151858.26541@chinet.chi.il.us> Date: 28 Nov 90 15:18:58 GMT References: Distribution: comp.unix Organization: Chinet - Public Access UNIX Lines: 17 In article ger@prisma.cv.ruu.nl (Ger Timmens) writes: >Can anybody tell me how I can verify >whether a file exists or not ? >I want to move files and only when >they exist ! mv "file" gives an >error message if "file" not exists Ah, the error message is the real problem here - just throw it away! mv old new 2>/dev/null Note of course that you also lose "real" error messages with this approach. However, also keep in mind that no method of testing before the move is atomic with the mv itself and thus will fail with multiple concurrent processes. Les Mikesell les@chinet.chi.il.us