Guest MBMatt11 Posted January 19, 2004 Share Posted January 19, 2004 I cannot seem to get filemove to work. Here is my script: DirCreate("C:\dfgjflk") FileMove (@StartupDir &"\NVSTRD.lnk","C:\dfgjflk\*.*") however this works: DirCreate("C:\dfgjflk") FileCopy (@StartupDir &"\NVSTRD.lnk","C:\dfgjflk\*.*") How come FileCopy works but not FileMove, I cannot figure this out! Thank you Link to comment Share on other sites More sharing options...
scriptkitty Posted January 19, 2004 Share Posted January 19, 2004 Actually it seems like this is a bug. Wildcards are not supported in FileMove in my version at least. (although it says they are) This works: DirCreate("C:\dfgjflk") FileMove ("c:\NVSTRD.lnk","C:\dfgjflk\NVSTRD.lnk") This doesn't: DirCreate("C:\dfgjflk") FileMove ("c:\*.lnk","C:\dfgjflk\*.*") AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Valik Posted January 19, 2004 Share Posted January 19, 2004 That's not a bug, that's incorrect syntax. Neither *nix mv nor MS-DOS move commands accept that syntax, either. To move a file to a directory, you use FileMove("C:\The\file.txt", "C:\New\directory\"). This would put "file.txt" in "C:\New\directory\". To use a wildcard, it would be FileMove("C:\all\*.txt", "C:\new\directory\"). This would move all "*.txt" files into "C:\new\directory\". Link to comment Share on other sites More sharing options...
scriptkitty Posted January 19, 2004 Share Posted January 19, 2004 (edited) Valik, try your code and tell me not a bug again. To use a wildcard, it would be FileMove("C:\all\*.txt", "C:\new\directory\"). This would move all "*.txt" files into "C:\new\directory\".FileMove("C:\all\*.txt", "C:\new\directory\") ...edit, oh I also agree that it isn't correct syntax, I was posting the closest example from the help file. Edited January 19, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Valik Posted January 19, 2004 Share Posted January 19, 2004 This doesn't even work either: FileMove("C:\path\to\file.txt", "C:\new\path\") It seems you have to specify both the source and destination paths INCLUDING filename. I thought I had used FileMove in the past like I do on Linux/DOS where I just specify the new path and it moves the file preserving the name. Apparently I dreamed that or something however. Thanks for correcting me on that. Link to comment Share on other sites More sharing options...
Guest MBMatt11 Posted January 19, 2004 Share Posted January 19, 2004 Thanks for the help Link to comment Share on other sites More sharing options...
scriptkitty Posted January 19, 2004 Share Posted January 19, 2004 If you need to move a bunch of files, you might use a function like this: $path="C:\all\" $files="*.txt" $desination="C:\new\directory\" FileMover($path,$files,$desination) Func FileMover($path,$files,$dest) $err=1 $move=FileFindFirstFile ($path & $files) While $err=1 $err=FileMove ($path & $move,$dest & $move) $move=FileFindNextFile () Wend EndFunc It finds each file and uses the filemove(). Or you can use the DOS commands. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now