Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

move file...but make sure no process is writing to it

Status
Not open for further replies.

aswolff

Programmer
Joined
Jul 31, 2006
Messages
100
Location
US
Hi.

I need to create a sweeper program that moves files from one unix directory to another and changes the extension. But I need to ensure that the file is not being written to at the time I move it or I will corrupt the file. Any suggestions?

Plan B: Just look at the modified date and only pick up files older then 10 minutes or something...but I am trying to see if there are better ways than this.

Any feedback is appreciated.
 
You could use the "lsof" command, which lists open files.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top