Re: Problem while deleting shape file [message #56291] |
Fri, 12 October 2007 02:40 |
raval.chintan
Messages: 54 Registered: May 2005
|
Member |
|
|
On Oct 12, 5:57 am, "tia...@gmail.com" <tia...@gmail.com> wrote:
> On Oct 11, 7:45 pm, raval.chin...@gmail.com wrote:
>
>
>
>
>
>> Hi,
>
>> I have written one program in which I am processing one shape file.
>> Once I process it I want to delete the shape file from physical
>> memory. for that I have written a below example program.
>
>> PRO ex_shapefile
>
>> file = dialog_pickfile()
>
>> ; Open the states Shapefile in the examples directory.
>> myshape=OBJ_NEW('IDLffShape', file)
>
>> ; Get the number of entities so we can parse through them.
>> myshape->GetProperty, N_ENTITIES=num_ent
>
>> ; Read all the entities.
>> FOR x=1, (num_ent-1) DO BEGIN
>> ;Read the entity x
>> ent = myshape->GetEntity(x)
>> ;Clean-up of pointers
>
>> myshape->DestroyEntity, ent
>> ENDFOR
>
>> ; Though next statement is not required because I have open my shape
>> file in read only mode
>
>> myshape->Close
>
>> ; Close the Shapefile.
>> OBJ_DESTROY, myshape
>
>> ; My Process
>
>> ;Delete shape file Problem is over here.
>> ; though I have close the file I have destroy the object then also not
>> able to delete the file
>
>> file_delete,file
>
>> END
>
>> Now my problem is whenever I am deleting the file through file_delete
>> procedure , IDL is giving me error permission denied. I am having all
>> the rights for a folder in which this file is available.
>
>> That means IDL is not allowing me to delete the above file .... :-
>> ( ... Is it a bug in IDL? Kindly correct me if I am wrong.
>
>> Regards
>> Chintan
>
> Are you sure you have the write permission for the Shape FILE ? Type
> "ls -l" to have a look.
>
> Best,
> Tian- Hide quoted text -
>
> - Show quoted text -
Hi Tian,Jean
Thanks for Help.
You both were right . Unfortunately My folder was read only.
Regards
Chintan
|
|
|
Re: Problem while deleting shape file [message #56293 is a reply to message #56291] |
Thu, 11 October 2007 17:57  |
enod
Messages: 41 Registered: November 2004
|
Member |
|
|
On Oct 11, 7:45 pm, raval.chin...@gmail.com wrote:
> Hi,
>
> I have written one program in which I am processing one shape file.
> Once I process it I want to delete the shape file from physical
> memory. for that I have written a below example program.
>
> PRO ex_shapefile
>
> file = dialog_pickfile()
>
> ; Open the states Shapefile in the examples directory.
> myshape=OBJ_NEW('IDLffShape', file)
>
> ; Get the number of entities so we can parse through them.
> myshape->GetProperty, N_ENTITIES=num_ent
>
> ; Read all the entities.
> FOR x=1, (num_ent-1) DO BEGIN
> ;Read the entity x
> ent = myshape->GetEntity(x)
> ;Clean-up of pointers
>
> myshape->DestroyEntity, ent
> ENDFOR
>
> ; Though next statement is not required because I have open my shape
> file in read only mode
>
> myshape->Close
>
> ; Close the Shapefile.
> OBJ_DESTROY, myshape
>
> ; My Process
>
> ;Delete shape file Problem is over here.
> ; though I have close the file I have destroy the object then also not
> able to delete the file
>
> file_delete,file
>
> END
>
> Now my problem is whenever I am deleting the file through file_delete
> procedure , IDL is giving me error permission denied. I am having all
> the rights for a folder in which this file is available.
>
> That means IDL is not allowing me to delete the above file .... :-
> ( ... Is it a bug in IDL? Kindly correct me if I am wrong.
>
> Regards
> Chintan
Are you sure you have the write permission for the Shape FILE ? Type
"ls -l" to have a look.
Best,
Tian
|
|
|
Re: Problem while deleting shape file [message #56294 is a reply to message #56293] |
Thu, 11 October 2007 16:43  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
raval.chintan@gmail.com wrote:
> Hi,
>
> I have written one program in which I am processing one shape file.
> Once I process it I want to delete the shape file from physical
> memory. for that I have written a below example program.
> Now my problem is whenever I am deleting the file through file_delete
> procedure , IDL is giving me error permission denied. I am having all
> the rights for a folder in which this file is available.
>
> That means IDL is not allowing me to delete the above file .... :-
> ( ... Is it a bug in IDL? Kindly correct me if I am wrong.
>
>
> Regards
> Chintan
Chintan,
your code works perfectly here...no error.. I am on Windows XP.
however, it only deletes the .shp file, not all the files that comes
along! ... you might want to look for all files that start with your
filename, no matter of the extension, and then delete them
Jean
|
|
|