Jump to content

Filemove, Files Missing Extensions, Locked, Unlock?


 Share

Recommended Posts

Hi :)

Apparently there's some bug between vms and windows 2003 that see's some files moved to windows losing their extensions. e.g myfile. (just a dot no extension e.g .eps).

These files appear to be locked (cant copy them etc within windows (file/directory does not exist error).

Been playing with filemove to try and move them elsewhere and give them an extension. Wont work for me on the extensionless files, works for other files (with extensions or without, but cant create a file with just a dot for an extension for testing e.g myFile.

Saw some comments in the forum about filelock/fileunlock using dllcall, no examples though, would this help?, anyone have such an example or any workaround that may help?

Appreciate any help

ta

:mellow:

Link to comment
Share on other sites

Hi zichy,

Apparently

Let's stop at your 1st word. You are mentioning an issue that probably does not exist? How do I know that you are competent with using FileMove() or general AutoIt syntax without a shred bit of code that can prove what is going wrong. Atleast show something for the claim to be true otherwise it could be a waste of time.

Edit:

FileMoved that has no extension

FileMove(@ScriptDir & '\cmd1', @ScriptDir & '\cmd2')
Edited by MHz
Link to comment
Share on other sites

Ok sorry for not elaborating, using a simple filemove command (in the interim) till i get a result with the locked files.

Example filemove

; Code Starts

$mySource="c:\1"

$myDestination="c:\2"

FileMove($mySource & "\*" ,$myDestination & "\*.eps",9) ; Move all the files in c:\1 directory to c:\2 as .eps's

Exit

;Code ends

Regards

EDIT: oops i wasnt refering to a bug in Autoit and filemove, its a known ftp-ing issue out of openVMS into Windows 2003 Server

Hi zichy,

Let's stop at your 1st word. You are mentioning an issue that probably does not exist? How do I know that you are competent with using FileMove() or general AutoIt syntax without a shred bit of code that can prove what is going wrong. Atleast show something for the claim to be true otherwise it could be a waste of time.

Edit:

FileMoved that has no extension

FileMove(@ScriptDir & '\cmd1', @ScriptDir & '\cmd2')
Edited by zichy
Link to comment
Share on other sites

Sorry for my boldness. I needed more info to understand the fault. I would use FileFindFirstFile...as if any files are locked by some other source, then the FileMove can proceed with the next file. I'm not totally sure ATM if FileMove fails on the 1st file not movable.

If you want a solution for the locked files, then one should 1st look for the root cause of why they are locked. If your openVMS is locking them, then it could be an idea to try to move the remaining files at a better time or some other action.

This is basically how FileFindFirstFile works:

$mySource = 'c:\1'
$myDestination = 'c:\2'

If FileChangeDir($mySource) Then
    $handle_search = FileFindFirstFile('*')
    If $handle_search <> -1 Then
        While True
            $file = FileFindNextFile($handle_search)
            If @error Then ExitLoop
            Select
                Case StringRight($file, 4) = '.eps'
                    FileMove($file, $myDestination & '\' & $file, 9)
                Case Else
                    FileMove($file, $myDestination & '\' & $file & '.eps', 9)
            EndSelect
        WEnd
    EndIf
EndIf

The above will check for extension expected and move it, else it will add the extension and move it. It will continue until the last file and then error to exit the loop.

Link to comment
Share on other sites

Might I suggest trying Microsoft's XCOPY.EXE...I've scripted this command to backup file servers when the office is closed. This a slow command so speed will be sacrificed for accurate and reliable copying.

Here is the help file.

Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
                           [/EXCLUDE:file1[+file2][+file3]...]

  source       Specifies the file(s) to copy.
  destination  Specifies the location and/or name of new files.
  /A           Copies only files with the archive attribute set,
               doesn't change the attribute.
  /M           Copies only files with the archive attribute set,
               turns off the archive attribute.
  /D:m-d-y   Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.
  /EXCLUDE:file1[+file2][+file3]...
               Specifies a list of files containing strings.  Each string
               should be in a separate line in the files.  When any of the
               strings match any part of the absolute path of the file to be
               copied, that file will be excluded from being copied.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively.
  /P           Prompts you before creating each destination file.
  /S           Copies directories and subdirectories except empty ones.
  /E           Copies directories and subdirectories, including empty ones.
               Same as /S /E. May be used to modify /T.
  /V           Verifies each new file.
  /W           Prompts you to press a key before copying.
  /C           Continues copying even if errors occur.
  /I           If destination does not exist and copying more than one file,
               assumes that destination must be a directory.
  /Q           Does not display file names while copying.
  /F           Displays full source and destination file names while copying.
  /L           Displays files that would be copied.
  /G           Allows the copying of encrypted files to destination that does
               not support encryption.
  /H           Copies hidden and system files also.
  /R           Overwrites read-only files.
  /T           Creates directory structure, but does not copy files. Does not
               include empty directories or subdirectories. /T /E includes
               empty directories and subdirectories.
  /U           Copies only files that already exist in destination.
  /K           Copies attributes. Normal Xcopy will reset read-only attributes.
  /N           Copies using the generated short names.
  /O           Copies file ownership and ACL information.
  /X           Copies file audit settings (implies /O).
  /Y           Suppresses prompting to confirm you want to overwrite an
               existing destination file.
  /-Y         Causes prompting to confirm you want to overwrite an
               existing destination file.
  /Z           Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...