Reply to Thread

Post a reply to the thread: How to determine that a folder is empty?

Your Message

Click here to log in

What's the name of our main installation product (in uppercase letters), directly followed by the current year?

 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Topic Review (Newest First)

  • 04-13-2005, 04:50 AM
    jbotwood

    Re: How to determine that a folder is empty?

    Thanks very much Friedrich, if you could add this feature it would be awesome

    Jeff
  • 04-11-2005, 10:34 AM
    linder

    Re: How to determine that a folder is empty?

    Jeff,

    I'll check if it is possible to add a search feature to handle wildcards. I'll let you know tomorrow.
  • 04-11-2005, 09:41 AM
    jbotwood

    Re: How to determine that a folder is empty?

    Ah ok, do you have any other suggestion as a way to do this, or should i go the custom DLL route?

    Jeff
  • 04-11-2005, 09:34 AM
    linder

    Re: How to determine that a folder is empty? - possible bug report in build 1101

    Sorry, the documentation is not correct. Wildcard characters (* and ?) are not allowed.
  • 04-11-2005, 09:26 AM
    jbotwood

    Re: How to determine that a folder is empty? - possible bug report in build 1101

    Thanks so much for the offer (I didn't reply for a while because I have been away from my installer for the last two weeks doing lesser work here). I would definately take you up on your kind offer, but I now think this is a bug:

    I have the new version of SetupBuilder now with the very eagerly awaited help file (yeah!!) which quotes:

    The Search for File function lets you search for files on the local system

    Parameters

    File Name
    [in] The name of the file that you want to search for. You can use the * and ? wildcards in this field to search for files that match a specific pattern

    Path to Search
    [in] The path to the folder that you want to search in

    Return Values

    If the function succeeds, the %_SB_ERRORCODE% return value is nonzero.
    If the function fails, the return value is zero

    The Search for File function recurses through subfolders during the search


    I am searching a folder with many subfolders, each containing a file called 'accura.exe'

    If I try File Name=* or *.* or *.exe or a*.exe or accur?.exe

    Then my return variable is always NULL. The %_SB_ERRORCODE% return value is always 0. If I search for a known filename, then it recursively lists every instance of the filename exactly as specified, but this is the only instance where this command works as in the help file

    Jeff
    Data Design Services
  • 03-23-2005, 02:29 AM
    gspillane

    Re: How to determine that a folder is empty?

    Hi Jeff,

    No problems I'll put one together for you, no charge , but I can't get to it for another week. Just let me know exactly what you need to look for and what feedback you need from the function. eg You need to look to see if a particular folder (full path?) exists and if so does it contain any files (certain files?), function returns "1" if it exists and has files, otherwise "0".

    Best Regards,

    Geoff Spillane
    Data Down Under
  • 03-22-2005, 10:57 AM
    jbotwood

    Re: How to determine that a folder is empty?

    Thanks very much for the offer of help. My trouble is I am not a programmer and don't have any programming tools except for SB5, so even if you told me what to do to implement it I wouldn't be able to! :-(

    I have tried using GetFileInfo to get the size of the folder, and the size of the folder\*.* but these don't work either. This also means i have no way of checking the size of a folder and it's contents during an installation, which would also be handy.

    My best idea so far is to search for a large number of commonly found file extensions and see if anything turns up on any of the searches, or in the case of size testing to add them all up individually. Just means a lot of code and the end result cannot be very accurate...

    How about freeware DLLs that do things like this? Do you know where I could find one?

    Regards,

    Jeff
  • 03-17-2005, 02:34 AM
    gspillane

    Re: How to determine that a folder is empty?

    HI Jeff,

    If friedrich doesn't have an easy answer using his built-in functions it would be an easy job to create the appropriate function and put it in a DLL and call the function from within the script and having the function return the relevant value. I can give you a hand if you need it.

    Best Regards
    Geoff Spillane
    Data Down Under
  • 03-16-2005, 11:28 AM
    jbotwood

    How to determine that a folder is empty?

    I want to validate a folder and check that it is empty, but can't figure out how to do this unless I know a filename in the folder. I have tried searching the folder for *.*, but returns a blank when I search a folder containing files. Also, I want to search a folder that may only contain other folders, so I'm not sure how I would do this?

    Jeff

Posting Permissions

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