LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-10-2010, 08:09 PM   #1
viperuk
LQ Newbie
 
Registered: Jan 2008
Location: UK
Distribution: Debian
Posts: 9

Rep: Reputation: 0
bash script file access check?


Hi all

I have been using linux for a bit of time but would still class myself as a noobie. I dont know excatly what I am looking for but I can best describe it in a sanario.

I have started creating bash scripts which are looped indefinetly which checks a folder for files to process. my problem is, is there any way to check if the file is complete, as if the file is large and is being coppied from a different volume the file may still be copying or if the file is being uploaded by a user over samba/nfs, and if the file is still copying the process will most likely fail. if anyone has any ideas on how to resolve my problem I would be greatful

viperuk
 
Old 12-10-2010, 08:20 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
The most robust method is, if the file is being copied, the copier copies it under a special name and renames when copying is complete. For example foo might be copied to foo.part which would be renamed as foo.

If that is not feasible an alternative is to use the last modification time of the file and not copy files with last modification times less than <whatever> time ago. The stat and date commands would be useful.
 
  


Reply

Tags
bash scripting



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script file access question KBriggs Linux - Newbie 2 08-10-2009 01:54 PM
bash script to check mount is ok procfs Programming 2 01-17-2007 06:19 PM
How do I check for directory in bash script? nadavvin Programming 1 09-13-2006 04:03 PM
How to check the bash script syntax? mesh2005 Linux - General 2 04-23-2006 08:22 AM
how to have bash script check whether it's a x session? bkeeper Linux - Newbie 9 02-21-2006 06:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration