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

Method for copying all files in a folder?

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

    Method for copying all files in a folder?

    Is there a method or command in Xbasic to copy all the files in named folder from one location to another, without individually listing every file in the folder? (for example, there is file.copy for files)



    NATHAN WHITE

    #2
    RE: Method for copying all files in a folder?

    Nathan,
    "From one location to another"? What's the another? Another folder? Another Drive? What is your reason for wanting to do this? Your answers will provider clearer direction.

    kenn
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

    Comment


      #3
      RE: Method for copying all files in a folder?

      Ken:

      It is my intention to be able to copy whole folders from the database to workstations without having to use extensive programming and to insure that all files are copied.

      Comment


        #4
        RE: Method for copying all files in a folder?

        Nathan, just out of curiosity, why would you want to do that ? Are you talking about the data files (.dbf), or the application programs ?

        Lowell

        Comment


          #5
          RE: Method for copying all files in a folder?

          Yah, that's what I am wondering? Is he talking about upgrades to the app? Get the right install program and that shouldn't be an issue.

          kenn
          TYVM :) kenn

          Knowing what you can achieve will not become reality until you imagine and explore.

          Comment


            #6
            RE: Method for copying all files in a folder?

            Let us think of windows95,98,2000. While using the explorer to manage your files, you can click on a file or folder and copy-and-paste it where ever you would like. If you copy a folder it will take that folder and all of its contents and paste them where you would like it to be. A5V4 has a feature file.copy(), which happens to copy a particular file you designate, to a location of your choice. What about copying folders and all of its contents? I would like to know if there is a way to reference a folder name and have it copy that folder name (and all of its contents without having to reference each individual file in the folder) and paste it to a location of my choice. Maybe something like folder.copy()? I don't know.

            You ask why. My answer is "for updating files automatically if there is something changed in a program." I do not wish to use Network Optimization. My second reason for this desired feature is simply "because I want to." As programmers I'm sure you can relate. It is a hassle to have to reference several files at once. Imagine if windows wouldn't let you move folders or groups of folders with one click of the button. MS would be out of business. When I write code, I want the code to be as flexible and as forgiving as possible. By referencing whole folders, I can remove and add files to those folders for updates and modifications without going back and rewriting a bunch of code in other programs.

            Comment


              #7
              RE: Method for copying all files in a folder?

              You sould use the

              DIM file_names[250] AS C ' or some number of your choosing

              dir_put("yourdirectory")
              files = filefind.first("*.*")
              i = 1
              WHILE .not. files.eof()
              file_names[I] = files.name()
              files.next()
              i = i + 1
              END WHILE

              to build a list of files to be copied. Then you could feed these names to a file_copy(old,new) command.
              There can be only one.

              Comment


                #8
                RE: Method for copying all files in a folder?

                THANK YOU!
                That was the answer I was looking for. If you were here, I would give you a cigar. :-)



                NATHAN

                Comment


                  #9
                  RE: Method for copying all files in a folder?

                  Stan,

                  Would you believe that operation will not work if the file in the folders do not have at least one attribute set (e.g. the archive bit). This is a bug (acknowledged by Selwyn) in the

                  filefind.first("*.*")
                  files.next()

                  functions that is replaced in version 5 with a new (faster and better) function.
                  Till then, I would suggest using a call to a DOS shell to either find files, change attributes, or copy files.

                  Regards,

                  Ira J. Perlow
                  Computer Systems Design & Associates
                  [email protected]
                  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


                    #10
                    RE: Method for copying all files in a folder?

                    Nathan,

                    Are there any negative aspects of copying an entire folder rather than just the updated files?

                    kenn
                    TYVM :) kenn

                    Knowing what you can achieve will not become reality until you imagine and explore.

                    Comment


                      #11
                      RE: Method for copying all files in a folder?

                      I have set up some utilities on my client�s servers to run every night, before I run my utility�s I like to backup the entire folder containing the database (in addition to there tape backup). I want to keep a full weeks backup so if its Monday I name the folder �folder name� + Monday etc.

                      There is just one rule you have stick to in order for this script to work, you cant use any spaces when naming the folders you want to copy, but you could use long names. If you use spaces Ms Dos will return an error "invalid number of parameters"

                      This is the part of the script that runs the backup

                      s_file = :a5.get_path()
                      d_file = :a5.get_path()+cdow(date())
                      filename = left(:a5.get_path(),3)+"copytemp.bat"
                      file_pointer = file.create(filename, FILE_RW_EXCLUSIVE)
                      file_pointer.write("xcopy "+s_file+" "+chr(47)+"e"+chr(47)+"c"+chr(47)+"i "+d_file)
                      file_pointer.flush()
                      file_pointer.close()
                      sys_shell(filename)


                      Try it
                      Daniel Weiss
                      Daniel Weiss
                      EZ Link Software

                      Comment


                        #12
                        RE: Method for copying all files in a folder?

                        Daniel

                        If you put double quotes(chr(34)) around the filepath/name, DOS will accept directories and file names with spaces in them.

                        Also, you should not use :a5.get_path() for a temporary file. This should be in your private directory. Otherwise, two network users running the script simultaneously would step on each other with batch file. Again, use chr(34) around the file specification to allow for spaces in the path.

                        This is the changed script:

                        s_file = :a5.get_path()
                        d_file = :a5.get_path()+cdow(date())
                        filename = :a5.get_private_path()+chr(92)+"copytemp.bat"
                        file_pointer = file.create(filename, FILE_RW_EXCLUSIVE)
                        file_pointer.write("xcopy "+chr(34)+s_file+chr(34)+" "+chr(47)+"e"+chr(47)+"c"+chr(47)+"i "+chr(34)+d_file+chr(34))
                        file_pointer.flush()
                        file_pointer.close()
                        sys_shell(chr(34)+filename+chr(34))

                        Regards,

                        Ira J. Perlow
                        Computer Systems Design & Associates
                        [email protected]
                        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


                          #13
                          RE: Method for copying all files in a folder?

                          Thanks Ira,
                          I also for forgot to include the �y� parameter that suppresses to conform you want to overwrite an existing destination file this needs to be added �+chr(47)+"y��
                          About the issue of two network users running the script simultaneously would step on each other with batch file. That�s a good taught, but I set this script up that it could only run from the server and the script first shots down all workstations
                          The script is scheduled to run at 11 pm each night and the first thing the script dose is,

                          getpath = :A5.Get_Master_Path()
                          if getpath ""
                          a5.close()
                          end if

                          But anyways it is a good suggestion and I will change my scripts accordingly
                          Thanks again
                          Daniel Weiss
                          Daniel Weiss
                          EZ Link Software

                          Comment


                            #14
                            RE: Method for copying all files in a folder?

                            You may also (via a script)be able to copy the folder to the clipboard and then paste the folder - I'm afraid I haven't tried this or written the script for you but I think it may well work.
                            Terry

                            Comment


                              #15
                              RE: Method for copying all files in a folder?

                              Thanks to everyone that has responded. I'm going to print all these suggestions and keep them for my file. Excellent.

                              One more question if I may.
                              Is .name() a character variable or a pointer? The reference manual states "Returns the name of the current file in the list of files referenced by the object pointer, ."



                              NATHAN

                              Comment

                              Working...
                              X