Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

DeleteDir always returns -1


13 replies to this topic

Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 01 May 2001 - 17:19

I have a routine using FindAllDirs and ListGetNextString inside of a Loop.  I have to identify specific 2 character directories that contain certain files I have to copy to a new target directory and delete the source directory. Once I find the direcory (could be more than one) I use XCopyFile and DeleteFile. Then I use DeleteDir with ALLCONTENTS. I trapped the return code and it is always -1. The path I specify seems correct (C:\RC for example). I can exit Install and delete this directory. I also remove other directories but I can not with this situation in this loop.
I would like to be able to delete this directory. Nothing  is marked read-only, and I am not specifying the ROOT. If I have 2 directories, I can not delete these two directories.

Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 02 May 2001 - 09:56

1 - Does the directory contain hidden files ?
2 - When DeleteDir returns -1, is it possible to remove the directory manually at that time (so before continuing with the installation) ?.

Ide


Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 02 May 2001 - 15:52

1) There are no hidden files.

2) While in my loop, when I find a directory to copy and delete, at that time I cannot delete it using DeleteDir with ALLCONTENTS. Explorer will not delete it either. When I advance and find the next directory to copy, I can manually delete the first directory with Explorer. I can not delete the last directory until InstallShield terminates. What is holding these files open? Why was I able to manually delete one and not the other?
I am going to have to remove the directories later somehow but I have already deleted all of the files in them so I  can't identify them later.


Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 02 May 2001 - 16:55

Hmm... Sound like IS locks the directory somehow.
Try   ChangeDirectory(SRCDIR) before DeleteDir.

Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 02 May 2001 - 23:09

I put a ChangeDir for the root, even though I never did a ChangeDir to those directories I want to delete. My setting for ChangeDir was to another directory. It didn't change a thing.

Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 03 May 2001 - 08:35

Still more suggestions:
Is there perhaps a program in the directory which is running when you try to delete the directory ?
Are you trying to delete directories which are used by IS at runtime ?

Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 03 May 2001 - 15:57

No programs running. The specific directories I am dealing with contain data files. It is a two character directory name suppled by the user which contains a 'blank' set of data files so the user can practice using some of the software features without harming their office data. Unfortunetly, some offices treat these directories as additional data to seperate provider's records. So instead of buying two licenses for two doctores, they use two direceories, one for each provider. This is something we discourage, but have to treat as live data now.
We are changing our directory structure to one that is one level deeper. We used to have our directories right off of the root. We are going to a new 32 bit program and are putting the same directories under a new folder \rlisys. (for ex: \df becomes \rlisys\df).
I can get rid of all other directories except the ones I am using XCopyFile and the loop that uses the list of directories that I interogate, looking for specific directories (i.e. specific files exist in).
I have created a program that will delete these directories and tried running in later in the script and I still cannot delete the last directory in the list.
I am using FindAllDirs and suspect this is locking access to the directories. I am not using FindAllFiles.

Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 03 May 2001 - 16:15

Quote
I am using FindAllDirs and suspect this is locking access to the directories. I am not using FindAllFiles
I tend to agree. Perhaps FindAllDirs uses FindAllFiles under water or something. You might try using
FindAllFiles(svDir, "*.*", svDummyFile, CANCEL) to make sure all files in the directory are unlocked. Otherwise I'm kind of running out of options here. If this doesn't work, send me the your script-code, and I'll see if I can reproduce your problem on my machine. Perhaps that will clarify what's happening ...

Ide


Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 03 May 2001 - 22:15

Great suggestion! It worked!

I can not find any reference to this specific command using CANCEL : FindAllFiles(svDir, "*.*",  vDummyFile, CANCEL). Where is this documented?

I used it by putting the actual directory into svDir, and never set svDummyFile  to anything.

Now and can return to coding and stop trying to program around a problem. Thanks!


Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 04 May 2001 - 09:17

I don't where (and if) it is documented for IS 5. Haven't found in on the Installshield help-site either. It is documented in the IS 6.1 documentation, where I found it.
Bit of bad move on the part of InstallShield not to document this. But then again, it is where this messageboard comes in handy ;-)

'bout the svDummyFile parameter in FindAllFiles : Normally it is the parameter in which the first found file is returned, but it has no meaning when you specify CANCEL as action.

Glad I could help, Ide


Vijay123

Vijay123
  • Full Members
  • 3 posts

Posted 09 August 2010 - 16:02

I too have similer kind of problem.

i am unable to remove the directory having contents with
DeleteDir("c:\\progrm files\\ ....\\xyz",ALLCONTENTS);

it is alway returning -1, here the OS is Windows VISTA, and the files are in ReadOnly mode

is anyone know the way how to delete files/directory in this case.


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 10 August 2010 - 14:22

Vijay123, have you tried deleting those same files from Explorer while your InstallShield setup is running and again after IS has exited? Also, what if the files are no longer read only?
user posted image

Vijay123

Vijay123
  • Full Members
  • 3 posts

Posted 10 August 2010 - 15:16

QUOTE (Taco Bell @ 2010-08-10 14:22)
Vijay123, have you tried deleting those same files from Explorer while your InstallShield setup is running and again after IS has exited?  Also, what if the files are no longer read only?

hi Bell, thanks for your time on this

i am trying this removal of files in the process of uninstalling the Appliaction. when i tried to delete this foder in explorer manually First i am getting "Access Denied" do you want to continue,
when i procced with 'Yes' then it is removing files.

For Radonly Attribute of files:
these are html files it's basic purpose to provide help, and around 60 MB of size
they are basically in readonly attributes

And my attempt to remove the Readonly attribute is also failing with "Access Denied" error.






Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 11 August 2010 - 14:23

Well the "Access Denied" error explains the failed IS return code, so I would check the permissions on these files and their history. You may also want to check the impact of UAC settings.
user posted image