SPONSORS:






User Tag List

Results 1 to 5 of 5

Thread: File Deletion

  1. #1
    Senior Member
    Join Date
    Mar 2001
    Posts
    161
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    File Deletion

    User K. Hari Prasad (khprasad@quark.stpm.soft.net) posted:

    Hi
    I need to delete a file which is Read-Only.
    I used following code.
    [ ] HFILE FileHandle =
    FileOpen("D:\DmsAssets\ark_R1.eps.qhd",FS_DENY_NON E)
    [+] if(SYS_FileExists("D:\DmsAssets\ark_R1.eps.qhd"))
    [ ] SYS_RemoveFile("D:\DmsAssets\ark_R1.eps.qhd")

    I tried all parameters in Fileopen method but in vain..

    I am able to delete that particular ReadOnly file manually.

    Can anyone suggest me how I can do this..?

    Thanks for your time

    K.Hari Prasad
    Post message: silktest@yahoogroups.com
    Subscribe: silktest-subscribe@yahoogroups.com
    Unsubscribe: silktest-unsubscribe@yahoogroups.com
    List owner: silktest-owner@yahoogroups.com
    URL to this page: http://groups.yahoo.com/group/silktest


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: File Deletion

    You cannot delete a file which is read-only. But you can alter that file's properties to remove it's read-only status, in order to then delete it. For this you will need to use the GetFileAttributes() and SetFileAttributes() functions.

    ------------------

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: File Deletion

    2 ways I can think of:

    //just remove the file under windows
    //similar stuff for unix
    SYS_Execute("del {filename} /y")
    Or

    Change the file attribute using this
    function.

    //move your file to another place and
    //deal with it later. How garbage bin works

    SYS_MoveFile("{filename}","{Directory}")


    ------------------

  4. #4
    Senior Member
    Join Date
    Mar 2001
    Posts
    161
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: File Deletion

    User K. Hari Prasad (khprasad@quark.stpm.soft.net) posted:

    Hi All
    Well ,after many trails I got following solution.Here is the solution.

    [+] if(SYS_FileExists("D:\Assets\ark_R1.eps.qhd"))
    [ ] SYS_Execute("attrib -r
    D:\DmsAssets\ark_R1.eps.qhd")
    [ ] SYS_RemoveFile("D:\DmsAssets\ark_R1.eps.qhd")

    SYS_Execute command executes DOS command.

    Pls let me know if others have any better solution than this.

    Thanks


    K.Hari Prasad
    Post message: silktest@yahoogroups.com
    Subscribe: silktest-subscribe@yahoogroups.com
    Unsubscribe: silktest-unsubscribe@yahoogroups.com
    List owner: silktest-owner@yahoogroups.com
    URL to this page: http://groups.yahoo.com/group/silktest


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



  5. #5
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: File Deletion

    For your convenience:

    I am under win2k Pro.
    Good Luck.

    N.B. do a del/? for help

    ------------------


    [This message has been edited by GodKnows (edited 05-23-2001).]

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:34 PM.

Copyright BetaSoft Inc.