PDA

View Full Version : Copying files



NewsArchive
02-26-2009, 01:31 PM
Hi Friedrich,

During an install I'm copying files from an old install folder to a new
install folder if an existing install is detected. Here is a problem:

I copy several files with wildcards such as *.tps or *.DBF. If NO file is
found with the wildcard, the copying fails with SB_ERRORCODE 0. I could use
the file handling function to count the files, but according to the docs
search level of 0 searches ALL levels, where 1 searches the root level AND
one sub level. The problem is there COULD be sub folders with the same
files so this is not reliable since apparently it can't search JUST the root
level - or am I missing something.

Any ideas how best to deal with this situation?

Best regards,

--
Arnór Baldvinsson - Icetips Creative, Inc.
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
02-26-2009, 01:32 PM
Hi Arnór,

> but according to the docs search level of 0 searches ALL levels, where
> 1 searches the root level AND one sub level.

IMO, "1 searches the root level AND one sub level" in the docu does not make
any sense at all. I think we had this in a pre-release, but the final
release only searches the root level if a search level of 1 is used.

I just checked this. Okay, I have:

c:\test\Arnór.dbf
c:\test\Clarion.dbf
c:\test\subfolder\Microsoft.dbf

I search for:

Path Name: c:\test\*.dbf
Search Depth: 1

It detects "2" files. Correct (both are in the "root").

Then I search for:

Path Name: c:\test\*.dbf
Search Depth: 2

It detects "3" files. Correct (2 from the root, 1 from the subfolder).

So it seems to me that the documentation is incorrect here. I'll fix this.

Thank you for bringing this to my attention.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
02-26-2009, 01:32 PM
Hi Friedrich,

> Thank you for bringing this to my attention.

Welcome - that didn't make sense to me either<g>

Question remains: Copy %IT_OLD_DATAPATH%*.dbf fails if there are no *.dbf
files in it. Should it fail since there were no files to copy and thus no
error in the copy process?

Best regards,

--
Arnór Baldvinsson - Icetips Creative, Inc.
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
02-26-2009, 01:33 PM
>> Thank you for bringing this to my attention.
>
> Welcome - that didn't make sense to me either<g>

<G>

> Question remains: Copy %IT_OLD_DATAPATH%*.dbf fails if there are no
> *.dbf files in it. Should it fail since there were no files to copy
> and thus no error in the copy process?

Our postings crossed (see message I posted 30 seconds ago). According to
Microsoft, I think the error is correct.

Friedrich

NewsArchive
02-26-2009, 01:33 PM
> IMO, "1 searches the root level AND one sub level" in the docu does not make
> any sense at all. I think we had this in a pre-release, but the final
> release only searches the root level if a search level of 1 is used.


Does this also apply to the "Check InUse Folder Tree" function...


John Newman
Software Partners Australia

NewsArchive
02-26-2009, 01:34 PM
Hi John,

>
> Does this also apply to the "Check InUse Folder Tree" function...
>

Yes!

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
02-26-2009, 01:34 PM
> Yes!

Thank you, I had wondered about this<G>


John Newman
Software Partners Australia

NewsArchive
02-26-2009, 01:34 PM
Hi Friedrich,

> Any ideas how best to deal with this situation?

Food for thought Should the Copy files report an error when using wildcards
if there are no files to copy? It would be nice to be able to specify if
that is a valid situation - like in my case where certain files are created
ONLY if certain options are installed in the program. But those files need
to be copied in case they are there. The If File or Folder... thing does
not support wildcards (according to the docs) so the other option is to use
the File list handling (which I'm working out now) to count the files and/or
loop the file list and copy the files individually.

Best regards,

--
Arnór Baldvinsson - Icetips Creative, Inc.
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
02-26-2009, 01:35 PM
Hi Arnór,

Interesting question.

When doing a command line COPY *.xyz (and .xyz does not exist), Windows
gives a "The system cannot find the file specified" error.

And Microsoft says that it is an error:

http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/w2000Msgs/3710.mspx?mfr=true

So IMO, the installer correctly reports a failed operation here.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
02-26-2009, 01:35 PM
Hi Friedrich,

> And Microsoft says that it is an error:
>
> http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/w2000Msgs/3710.mspx?mfr=true
>
> So IMO, the installer correctly reports a failed operation here.

Agreed, but then again it would be nice to be able to distinguish between an
error in the copy process or an error because there are no files. Perhaps a
checkbox "Succeed if no files found" or something like that and if that was
checked it would still succeed even if there were no files found.

Best regards,

--
Arnór Baldvinsson - Icetips Creative, Inc.
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
02-26-2009, 01:36 PM
> Agreed, but then again it would be nice to be able to distinguish between
> an error in the copy process or an error because there are no files.
> Perhaps a checkbox "Succeed if no files found" or something like that and
> if that was checked it would still succeed even if there were no files
> found.

Or the number of "processed" files returned in, say, %_SB_RETURNEX%. Then
we always know how many files were "processed" (= found).

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
02-26-2009, 01:36 PM
Hi Friedrich,

> Or the number of "processed" files returned in, say, %_SB_RETURNEX%. Then
> we always know how many files were "processed" (= found).

Yes, that would be my vote!

Best regards,

--
Arnór Baldvinsson - Icetips Creative, Inc.
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
02-26-2009, 01:37 PM
Hi Arnór,

>> Or the number of "processed" files returned in, say, %_SB_RETURNEX%.
>> Then we always know how many files were "processed" (= found).
>
> Yes, that would be my vote!

Okay! I'll add it to the next SB7 and SB6 builds.

Friedrich

NewsArchive
02-26-2009, 01:37 PM
>
> Yes, that would be my vote!
>

Added. If you need access to that build, let me know.

Friedrich


SetupBuilder 6.9 -- Build 2519 INTERNAL BUILD (February 26, 2009)
----------------------------------------------------------------------------

IMPROVEMENT: (sync from SB7) Installer: When using the "Load File List"
option in the "Handle File Listing..." function, the
%_SB_RETURNEX% variable holds the number of files in the file
list.

IMPROVEMENT: (sync from SB7) Installer: When using the "Copy File(s)..."
script function, the %_SB_RETURNEX% variable holds the number
of copied files.

IMPROVEMENT: (sync from SB7) Installer: When using the "Copy Folder
Tree..." script function, the %_SB_RETURNEX% variable holds
the number of copied files.

IMPROVEMENT: (sync from SB7) Installer: When using the "Move File(s)..."
script function, the %_SB_RETURNEX% variable holds the number
of copied files.

IMPROVEMENT: (sync from SB7) Installer: When using the "Move Folder
Tree..." script function, the %_SB_RETURNEX% variable holds
the number of copied files.

FIX : (sync from SB7) IDE: "Set x64 Mode..." item could not be
deleted from within the Script Editor.

FIX : (sync from SB7) IDE: The "Play WAV File..." script element with
no file name stops WAV playback. The function did not accept an
empty Path parameter.

FIX : (sync from SB7) Installer: Under certain circumstances, the
installation wizard displayed the BACK button even if all
previous wizard dialogs had "hidden" status.

FIX : (sync from SB7) [SB#902251] Installer: The "Load File List"
option in the "Handle File Listing..." function was case-
sensitive when using wildcards.

CHANGE : (sync from SB7) Installer: Minor dialog show/hide management
modifications.

NewsArchive
02-26-2009, 01:38 PM
Hi Friedrich,

> Added. If you need access to that build, let me know.

No, I'm good for now:)

One thing I stumbled on, that you might want to look at. I presumed that
the file list worked similar to the clarion DIRECTORY() queue so I called
the Load list several times with different wildcards and THEN looped through
the list and after the loop I freed the list. This resulted in some weird
list being copied. If I took each wild card and looped through it
separately it worked as expected (except the case sensitive part). In
Clarion you can do things like:

Directory('*.tps',Q)
Directory('*.dbf',Q)

(Or whatever the syntax is<g>) and it will simply keep adding the file list
to the queue and then you can process it. This would be excellent in SB
since sometimes you might need to specify several wildcards to copy or
delete or whatever and this would be an excellent way to build the list.

Best regards,

--
Arnór Baldvinsson - Icetips Creative, Inc.
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
02-26-2009, 01:38 PM
Hi Arnór,

>> Added. If you need access to that build, let me know.
>
> No, I'm good for now:)

Okay :)

> One thing I stumbled on, that you might want to look at. I presumed
> that the file list worked similar to the clarion DIRECTORY() queue so
> I called the Load list several times with different wildcards and THEN
> looped through the list and after the loop I freed the list. This
> resulted in some weird list being copied. If I took each wild card
> and looped through it separately it worked as expected (except the
> case sensitive part). In Clarion you can do things like:
>
> Directory('*.tps',Q)
> Directory('*.dbf',Q)
>
> (Or whatever the syntax is<g>) and it will simply keep adding the file
> list to the queue and then you can process it. This would be excellent
> in SB since sometimes you might need to specify several wildcards to
> copy or delete or whatever and this would be an excellent way to build
> the list.

Hmm, the "Load File List" option should always free the queue. I'll check
this.

I agree. An option to not free the queue is a good idea. I'll give it some
thoughts.

Thanks,
Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
02-26-2009, 01:39 PM
Hi Friedrich,

> Hmm, the "Load File List" option should always free the queue. I'll check
> this.

It may have done, but it _did_ copy some files that were not just in the
last wildcard I used so it was like it stored something (maybe one file?)
from one Load to the next.

> I agree. An option to not free the queue is a good idea. I'll give it some
> thoughts.

Excellent. I think that would be a pretty nice option:)

Best regards,

--
Arnór Baldvinsson - Icetips Creative, Inc.
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php