Find the answer to your Linux question:
Results 1 to 6 of 6
when i am working with a file that opened file also deleting when some one deleting that file .How to prevent a file not to be deleted when it is ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3

    file deletion problem

    when i am working with a file that opened file also deleting when some one deleting that file .How to prevent a file not to be deleted when it is in read or write mode opened .Please give me the reply.............





    Thank You.

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    Quote Originally Posted by suresh2many View Post
    when i am working with a file that opened file also deleting when some one deleting that file .How to prevent a file not to be deleted when it is in read or write mode opened .Please give me the reply.............
    Thank You.
    I can't understand you requirement. Normally a opened file ,if deleted , will remain available as long as they not closed.
    For example,
    open mp3 file and play in music player. After few seconds delete the file from it's original location.
    Though file is deleted , since it was opened my music player application , you will continue to hear the song. Once the song is completed and if you play the next song previous file is closed ,hence lost.


    Quote Originally Posted by suresh2many View Post
    fg fgdg dsfds fdsfsdf sdfsdfs sdfsdfsdfsdfdsfds sdfsdfsdfs
    Please understand , no one here get paid to answer your questions.
    http://www.linuxforums.org/forum/lin...ums-rules.html
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3
    i am trying to develop a program which reads data from one file and write that to another file . In the middle also the opened file is deleting when we delete.But it is not happen in windows os .I want that same thing that is the file not to be delete when it in use.Please give the rly......Thank you

  4. #4
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    Quote Originally Posted by suresh2many View Post
    i am trying to develop a program which reads data from one file and write that to another file .
    You mean like cp ?
    Quote Originally Posted by suresh2many
    In the middle also the opened file is deleting when we delete.But it is not happen in windows os .I want that same thing that is the file not to be delete when it in use.Please give the rly......Thank you
    Doesn't work like that in Linux. If you tell the computer to delete a file, it's going to delete the file. You'll have to program in your own failsafe if you want it, or copy someone's work.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  5. #5
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3
    thatnks for u rly ,if u have any idea please tell to me how to write that program or how to handle .

  6. #6
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096
    There are several ways to synchronize a cp, that is followed by an rm

    Easiest would be to to it in a script:
    cp <FILE> /some/where/ && rm <FILE>

    The rm part after && will only be executed, if the cp returned an errorstatus 0.

    Or you could use rsync.
    It has an option to delete the source file after succesfull sync.

    One could also think of lock files or more sophisticated methods.
    But actually, I am not 100% sure, what you want to achieve.
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...