Announcement

Collapse
No announcement yet.

powerbasic's "NAME" statement not working with changing case of letters

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

  • #21
    I found out the problem is on the SMBA side of things on our linux server. thats why windows or powerbasic never threw an error code. when I access our windows server I dont have any problems but when I try to do the same on the linux server on my windows laptop through the SMBA protocol then SMBA goes running home to momma without throwing an error code.

    I'll do some research on the linux forums to see what the fix is.

    thanks for your help guys.

    Comment


    • #22
      Glad you found it! I was looking into fsutil.exe where options could have been changed.
      https://www.howtogeek.com/354220/how...on-windows-10/
      How long is an idea? Write it down.

      Comment


      • #23
        SMBA? SMB or Samba?

        When I specifically asked "what file system" you answered:

        "As I mentioned in the original post - windows 10
        and I tried it on these different file volumes: NTFS and FAT32 and FAText on windows 10 with the same result."


        Now it turns out that your original statement: "I want to be able to rename a file in windows 10" should have been, "I want to be able to rename a file on a Linux server".

        Presumably that's an EXT4 file system.

        If you had told us that originally, it would have saved some of us a bit of time testing on Windows.

        Comment


        • #24
          Glad you found it!! You said that naming it a temporary name and then to the final name you want does work?

          Did you happen to try this suggestion? https://forum.powerbasic.com/forum/u...689#post796689

          Comment


          • #25
            These Windows API functions might interest you.

            https://docs.microsoft.com/en-us/win...nbase-copyfile

            https://docs.microsoft.com/en-us/win...nbase-movefile

            Comment


            • #26
              Kevin, your probably cache issues of various kinds.
              here as some of my workstation setting
              Code:
              Windows Registry Editor Version 5.00
              
              [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters]
              "DirectoryCacheLifetime"=dword:00000000
              "FileInfoCacheLifetime"=dword:00000000
              "FileNotFoundCacheLifetime"=dword:00000000
              "CacheFileTimeout"=dword:00000001
              "DormantFileLimit"=dword:00000001
              https://docs.microsoft.com/en-us/win...e/file-server/

              http://woshub.com/slow-network-share...indows-server/



              p purvis

              Comment


              • #27
                Be aware that in File Explorer, you'll have to refresh (F5) to see the changed name. (at least in some networked environments)
                Regards,
                Peter

                Comment


                • #28
                  The best speedup solution that I have found in renaming files is not to do it if the file names are already in the case you want them so do a compare of the file name first and it will still be slow.
                  when you utilize a ix system and want to process files by any ix system or transfer files then the case matters for smooth and untroubled operation.
                  We have batch routines that rename files from many points operating including when workstations log on or doing some kind of batch type process like a backup or archive or daily routine.

                  For true speed in processing on a server. Find an optional way of getting your server to do the work itself.
                  For any regular routine work that takes time where you need to reduce that time and if a server is able to perform the same work.
                  On any server you can control then you can place a looping process on the server to check periodically for a flag such as a file and upon finding that flag exist then do certain processes and if needed create a flag for another process that might be on a different computer monitoring that flag.
                  What I use on a Linux system are bash routines.
                  They an run on a cron time schedule or run at bootup in a loop that never ends.
                  I have one bash that starts at boot time and every 3 seconds checks for existence of a file used as a flag that a workstation creates then the server creates a zip file that contains large data files and after that the server creates a file flag the workstation has been monitoring for its existence since it created the file flag to instruct the server to create the zip file then the workstation copies the zip file off the server to the workstation. All this takes 8 seconds rather than a minute or longer if the workstation performed the complete work by itself.
                  You could probably create bash routines to process on the fly and place them on the server for the server to pick up.

                  SMB is just slow. You can reduce some time by not using netbios over TCPIP by connecting to the sever using port 445 rather than 139 using net use x: \\ipaddress\sharename.

                  Explorer or Browser Peter is right. F5 is your friend.
                  p purvis

                  Comment


                  • #29
                    I did some quick checking and i looks like using GETATTR on a shared device really is slow.
                    In my code loop through a directory and all its subdirectories I have this code below
                    ' Fileattribute=GETATTR(SubFolder(0&) & FileName)
                    If I remark it out all the code that reference the variable fileattribute then the process is speed up some and noticeable.
                    If I remove the GETATTR command as well, the process goes entirely acceptably fast.


                    p purvis

                    Comment


                    • #30
                      So, you didn't need GETATTR in the first place; or now the code does nothing really fast????????????????????
                      Dale

                      Comment


                      • #31
                        Multiple ways to rename all lower case.
                        Please read entire post as more advanced options are at the bottom.
                        The last post shows how to include subfolders in a batch file.

                        Something like this can be run before uploading files.

                        https://superuser.com/questions/6530...s-to-lowercase

                        This is recursive to include subfolders so please test while in a test folder.
                        Code:
                        rem This is recursive to include subfolders so please test while in a test folder.
                        rem  batch file
                        for /f "Tokens=*" %%f in ('dir /l/b/a-d') do (rename "%%f" "%%f")
                        for /r /d %%x in (*) do (
                            pushd "%%x"
                            for /f "Tokens=*" %%f in ('dir /l/b/a-d') do (rename "%%f" "%%f")
                            popd
                        )
                        How long is an idea? Write it down.

                        Comment


                        • #32
                          On a server share, if I use GETATTR on a list of files for whatever reason.
                          Then GETATTR will slow down the process a great amount, at least on my Linux server.
                          Whether you use GETATTR somewhere in your loop , I do not know.
                          Use the code on a large number of files in directory on a shared device

                          Code:
                          #COMPILE EXE
                          #DIM ALL
                          #BREAK ON
                          
                          FUNCTION PBMAIN () AS LONG
                              LOCAL sfilename AS STRING
                              LOCAL filecount AS LONG
                              LOCAL Fileattribute AS LONG
                          
                              sFileName = DIR$("*.*")
                              IF LEN(sFileName) THEN
                                  DO
                                     Fileattribute=GETATTR(sFileName)
                                      INCR Filecount
                                      'stdout sfilename
                                      sFileName = DIR$
                                  LOOP WHILE LEN(sFileName)
                                  DIR$ CLOSE
                              END IF
                              STDOUT STR$(filecount)
                          END FUNCTION
                          p purvis

                          Comment


                          • #33
                            Server share OR locally. When iterating over a lot of files:
                            Code:
                            DIR$(TO Dirdat)
                            x = Dirdata.FileAttributes
                            is MUCH faster than GETATTR
                            (Not so much for a single file as can be seen if you comment out the While-Wend loops below)

                            '
                            Code:
                            #COMPILE EXE
                            #DIM ALL
                            #INCLUDE ONCE "WIN32API.INC"
                            FUNCTION PBMAIN () AS LONG,
                             LOCAL s AS STRING
                            LOCAL l,x2,x1,i AS LONG
                            LOCAL qFreq, qStart, qStop,qwack AS QUAD
                            LOCAL qTime AS EXT
                            LOCAL dirdat AS DIRDATA
                            LOCAL strResult AS STRING
                               QueryPerformanceFrequency qFreq
                               FOR l = 1 TO 10
                                     x2 = 0
                                     x1 = 0
                                     QueryPerformanceCounter qStart
                                     s = DIR$("*.*" TO dirdat)
                                     x1 = dirdat.FileAttributes
                                     WHILE s > ""
                                       s = DIR$(TO dirdat)
                                       x1 += dirdat.FileAttributes
                                       INCR x2
                                     WEND
                                    QueryPerformanceCounter qStop
                                    strResult +=  "DirDataTime: Files"  & STR$(x2) & "Attr Sum:" & STR$(x1) &  " - " & FORMAT$((qStop-qStart)*1000/qFreq, "0.000")+" ms" & $CRLF
                            
                                    x1 = 0
                                    x2 = 0
                                    QueryPerformanceCounter qStart
                                    s = DIR$("*.*")
                                    x1 = GETATTR(s)
                                     WHILE s > ""
                                       s = DIR$()
                                       x1 += GETATTR(s)
                                       INCR x2
                                     WEND
                                   QueryPerformanceCounter qStop
                                   strResult +=  "GetAttrTime: Files"  & STR$(x2) & "Attr Sum:" & STR$(x1) &  " - " & FORMAT$((qStop-qStart)*1000/qFreq, "0.000")+" ms" & $CRLF & $CRLF
                               NEXT
                               ? strResult
                            END FUNCTION
                            '
                            ---------------------------
                            PowerBASIC
                            ---------------------------
                            DirDataTime: Files 250Attr Sum: 2031424 - 1.285 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 25.549 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.232 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.694 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.142 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.625 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.158 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.235 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.130 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 9.097 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.226 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.224 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.130 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.749 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.161 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.417 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.165 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.206 ms

                            DirDataTime: Files 250Attr Sum: 2031424 - 1.180 ms
                            GetAttrTime: Files 250Attr Sum: 2031424 - 8.389 ms
                            ---------------------------
                            OK
                            ---------------------------

                            Comment


                            • #34
                              or now the code does nothing really fast????????????????????
                              Reminds me of when I was General Manager of Systems Design, Inc, an Illinois VAR. While we were justly proud of our software (complete systems - inventory- purchasing- accounting etc.) for distributors) we had a number of new users who did not want to change "the old way" they were doing things - based on paper and pencil - to take advantage of the "power of computers."

                              We used to say (only amongst ourselves!) that rather than doing nothing, "<Client X> spent a lot of money to <expletive> up at 8 Mhz."

                              (The fact we used "8 Mhz" as our reference clock speed should tell you this was not last week).
                              Michael Mattias
                              Tal Systems Inc. (retired)
                              Racine WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #35
                                If you're using a NAS, it can speed up things if you switch to SMB 3.0 (if you're using an older version)
                                Also disabling ipv6 (if you don't use it) on NAS and pc can speed up things quite a bit...
                                Regards,
                                Peter

                                Comment


                                • #36
                                  Originally posted by Peter Lameijn View Post
                                  Iswitch to SMB 3.0
                                  Makes a huge difference. Anything beyond SMB v1 will give you a nice boost, but v3.x really shines.

                                  Originally posted by Peter Lameijn View Post
                                  disabling ipv6
                                  I have not found IP6 to perform any worse than IP4 on a LAN unless there is something wrong in the LAN. Check all your device settings (NICs, Switchs, Firewalls) to see if something is misconfigured. For example, there was some old Netgear equipment that did hardware offloading of IP4 but not IP6. You should be able to get the same performance from either if similarly configured. Now once you go to the 'wild' internet, all bets are off. Your performance for either depends on a lot of factors outside your control!

                                  Comment

                                  Working...
                                  X