Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User rbangar30's Avatar
    Join Date
    Oct 2011
    Posts
    10
    Hello,
    I am developing application which needs to delete oldest file in memory card.
    If any one is having related information plz e-mail me on rbangar30@gmail.com
    Thanx in advance.

  2. #2
    Nokia Developer Moderator petrib's Avatar
    Join Date
    Mar 2003
    Posts
    9,413
    JSR-75 FileConnection APIs has all you need to find, create, modify and delete files. Examples in the wiki: http://www.developer.nokia.com/Commu.../Data_Articles

    Details in the SDK docs.

  3. #3
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,903
    Quote Originally Posted by rbangar30 View Post
    Hello,
    I am developing application which needs to delete oldest file in memory card.
    If any one is having related information plz e-mail me on rbangar30@gmail.com
    Thanx in advance.
    Using FlieConnection API - FileConnection.list();Gets a list of all visible files and directories contained in a directory. The directory is the connection's target as specified in Connector.open().
    Now you can check the lastModified(); for each file and to identify the oldest filename.

    Once you get it - use FileConnection.delete() for this file and you are done.
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

  4. #4
    Registered User rbangar30's Avatar
    Join Date
    Oct 2011
    Posts
    10
    thanks Amitabh , but lastModified() Returns the time that the file denoted by the URL specified in the Connector.open() method was last modified.So to get oldest file I need to compare time of modification of all files in directory which is not at all feasible.
    Any other solution??

  5. #5
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,903
    Quote Originally Posted by rbangar30 View Post
    thanks Amitabh , but lastModified() Returns the time that the file denoted by the URL specified in the Connector.open() method was last modified.So to get oldest file I need to compare time of modification of all files in directory which is not at all feasible.
    Any other solution??
    Solution:
    Assume that the first file name is the oldest file, store its path and last modified in two variables, Now re-curse through the complete directory once - if you find any file with lastModified() long value is smaller then the one you assumed & stored (first one) as the oldest - store its path and last modified as the oldest... and continue the loop.

    At the end of the loop you will the oldest file - delete it.
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

  6. #6
    Registered User rbangar30's Avatar
    Join Date
    Oct 2011
    Posts
    10
    Quote Originally Posted by im2amit View Post
    Solution:
    Assume that the first file name is the oldest file, store its path and last modified in two variables, Now re-curse through the complete directory once - if you find any file with lastModified() long value is smaller then the one you assumed & stored (first one) as the oldest - store its path and last modified as the oldest... and continue the loop.

    At the end of the loop you will the oldest file - delete it.
    Ya its true but it will take lot of time if memory card has thousands of files.Is there any fastest solution??
    Thanx!!!

Similar Threads

  1. Cant read file on memory card
    By david.morgan in forum Symbian C++
    Replies: 4
    Last Post: 2011-01-07, 09:31
  2. direct copy a file from resource(jar file) to memory card
    By universoft in forum Mobile Java General
    Replies: 1
    Last Post: 2010-01-10, 13:39
  3. Reading text file stored in phone memory/memory card
    By devdattac in forum Mobile Java General
    Replies: 6
    Last Post: 2008-09-19, 19:30
  4. File Run Not working On Memory Card
    By kdurga in forum Symbian C++
    Replies: 11
    Last Post: 2008-07-16, 09:24
  5. Memory card file access
    By martin.wainamoinen in forum Mobile Java General
    Replies: 0
    Last Post: 2008-03-12, 22:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved