Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

file.remove

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    file.remove

    I'm trying to remove all files from a directory. Does file.remove support *.* file.remove("dir_path\*.*")
    Thanks
    Willie

    #2
    RE: file.remove

    What happens when you do it?
    Aaron Brown
    Alpha Software Development Team

    Comment


      #3
      RE: file.remove

      According to the Help file:
      Erases a particular file, removing it from the disk. You must supply an existing Filename.

      Comment


        #4
        RE: file.remove

        You can use file.remove() in conjunction with filefind.get_recurse() to get a list of all files in a directory, then loop through them and delete them.
        Aaron Brown
        Alpha Software Development Team

        Comment


          #5
          RE: file.remove

          here is how you could do it in just 2 lines of code:

          files = filefind.get("c:\webvars1*.txt",0,"pn")
          *for_each(x,file.remove(x),files)


          (this removes all files in my c:\ folder that match the patter: c:\webvars1*.txt


          if you examined files, you would have seen:
          = c:\Webvars1.Txt
          c:\Webvars10.Txt
          c:\Webvars100.Txt
          c:\Webvars101.Txt
          c:\Webvars102.Txt
          c:\Webvars103.Txt

          Comment


            #6
            RE: file.remove

            With one exception - filefind.get() and filefind.get_recurse() still don't work for files with the Archive attribute turned off:

            'All files in the target directory have all attributes turned off.
            ?filefind.get_recurse("H:\a5v5\_a5v5_std\logins","*.*")
            = ""

            ?filefind.get_recurse("H:\a5v5\_a5v5_std\logins","*.*",FILE_FIND_NORMAL)
            = ""

            ?filefind.get_recurse("H:\a5v5\_a5v5_std\logins","*.*",FILE_FIND_NOT_ARCHIVE)
            = ""

            ?filefind.get_recurse("H:\a5v5\_a5v5_std\logins","*.*",FILE_FIND_NOT_DIRECTORY)
            = ""

            'Now I have reset all files to have the archive attribute set.
            ?filefind.get_recurse("H:\a5v5\_a5v5_std\logins","*.*")
            = H:\a5v5\_a5v5_std\logins\Logins.adb
            H:\a5v5\_a5v5_std\logins\Logins.Muf
            H:\a5v5\_a5v5_std\logins\Logins.Alb
            H:\a5v5\_a5v5_std\logins\Logins.Alm
            H:\a5v5\_a5v5_std\logins\Logins.Alx
            H:\a5v5\_a5v5_std\logins\Logins.Recent_Files
            H:\a5v5\_a5v5_std\logins\App_Codes.Dbf
            H:\a5v5\_a5v5_std\logins\App_Codes.Cdx
            H:\a5v5\_a5v5_std\logins\App_Codes.Ddd
            H:\a5v5\_a5v5_std\logins\App_Codes.Ddm
            H:\a5v5\_a5v5_std\logins\App_Codes.Ddx
            H:\a5v5\_a5v5_std\logins\Copy of App_Codes.Ddx
            H:\a5v5\_a5v5_std\logins\Copy of App_Codes.Dbf
            H:\a5v5\_a5v5_std\logins\Copy of App_Codes.Ddd
            H:\a5v5\_a5v5_std\logins\Copy of App_Codes.Ddm
            H:\a5v5\_a5v5_std\logins\Copy of App_Codes.Cdx
            H:\a5v5\_a5v5_std\logins\_Doclogins.Dbf
            H:\a5v5\_a5v5_std\logins\_Doclogins.Fpt
            H:\a5v5\_a5v5_std\logins\_Doclogins.Cdx
            H:\a5v5\_a5v5_std\logins\_Doclogins.Ddd
            H:\a5v5\_a5v5_std\logins\_Doclogins.Ddm
            H:\a5v5\_a5v5_std\logins\_Doclogins.Ddx
            H:\a5v5\_a5v5_std\logins\Script_Usage.Txt
            H:\a5v5\_a5v5_std\logins\Function_Usage.Txt
            H:\a5v5\_a5v5_std\logins\Aims_Logins.Aex


            Since the archive attribute is supposed to be used by backup routines to determine whether or not a file should be incluced in an incremental backup, the archive bit should be turned off whenever a regular backup routine is run.

            Comment


              #7
              RE: file.remove

              >

              While this sounds like a bug, the reality is that very few backup programs actually use the archive bit for a number of reasons.
              Aaron Brown
              Alpha Software Development Team

              Comment


                #8
                RE: file.remove

                Regardless of what the backup routines do, there are numerous files on my computer that do not have the archive bit set. Here's the results of checking my system:

                C Drive - (1.8 gig used) - 503 files
                D Drive - not used; only 6 meg available
                E Drive - (1.8 gig used) - 2206 files
                F Drive - (1.3 gig used) - 197 files
                G Drive - not used; only 8 meg available
                H Drive - (15.5 gig used) - 11,429 files

                That makes 14,335 files on my computer that the Filefind functions can't see. I made no attempt to change anything prior to running this test except as noted in the next paragraph.

                The H drive is primarily for data files - Alpha, Access, Approach, Word, Excel, Help editor files, etc. In most cases, the Alpha data files have had the archive bit specifically turned on because I am aware of the potential issue.

                If anyone wants to check their own computer, go to the root directory in a DOS window and issue this command:
                DIR /a-a /s

                (For those not familiar with DOS, type DIR /? for an explanation of the command.)

                If only working with data files that are listed in the control panel of the database, there are other ways to get all the file names. However, if there are tables that are used but not included in the 'official' list shown in the control panel, the archive bit must be on for Filefind to locate them. Also, any graphics files, text files, etc. must have the archive bit on if there is any need to locate them with a Filefind function. All of these situations have occurred for me in past applications. The Filefind hasn't caused any major problems yet because I'm aware of the issue but there is one application where the customer regularly runs a loop that executes a DOS command to reset all the attributes to avoid any potential problems. This loop results in a bunch of little DOS icons scrolling across their Windows Taskbar then disappearing - annoying but not a problem.

                I tried using File.attributes_set() but that requires a specific filename and the only way to get the specific filename of unknown files (like graphics added by a user) is to use a Filefind function - classic Catch 22; you can't get there from here.

                SPECIFIC SITUATIONS THAT CAN RESULT IN THE ARCHIVE BIT BEING 'OFF':
                (not counting any backup routines that might still use it.)

                Copying data from a CD will result in all attributes OFF except the Read-only bit which is always ON. The Read-only bit is a well known issue. Many users are now aware that they need to turn the Read-only bit off because they have already experienced the fear of "Oh no! My data is gone!" but most don't know about the issue of turning on the archive bit. For data files this is typically a short term issue that disappears as soon as the table is changed but there are often other files such as graphics and text files that may not be modified for a long time. And, if the user adds new graphics, such as a realtor adding new property photos from a CD, there is no way for the program to know they are there.

                Files installed by an installation routine sometimes have the archive bit turned off. In some cases this may be because the original file had the bit turned off but, at least in the install routine I use, the install routine itself can be set to turn off all archive bits. I know that some installation programs I've run have installed files with the archive bit off.

                Comment


                  #9
                  RE: file.remove

                  Aaron,

                  Actually the bug doesn't list files when both the read-only and archive flags are clear at the same time. Any other variant (one or both) flags set, irrespective of System, Directory and Hidden flags settings works fine.

                  I reported this bug along time ago on the board in a thread with Selwyn in version 4.0 and 4.5

                  Regards,

                  Ira
                  Regards,

                  Ira J. Perlow
                  Computer Systems Design


                  CSDA A5 Products
                  New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                  CSDA Barcode Functions

                  CSDA Code Utility
                  CSDA Screen Capture


                  Comment

                  Working...
                  X