Jump to content

Search file and move


Sam31
 Share

Recommended Posts

I looking for a script which can do this:

----------------------------------------------

pathA = C:\folder01\

pathB = C:\folder02\

For all files in pathA

If file_name start with "B"

Then move to pathB

----------------------------------------------

Thanks

Link to comment
Share on other sites

Ok, well I am not aware of a FileMove() function native to AutoIT, so this is what I do:

Func _FileMove($Source, $Destination)
    FileWrite($Destination, FileRead($Source))
    FileDelete($Source)
    Return
EndFunc

And if you want to copy the file rather than move it, it is a similar function, but without the delete.

Func _FileCopy($Source, $Destination)
    FileWrite($Destination, FileRead($Source))
EndFunc

Hope that helps.

Link to comment
Share on other sites

Ok, well I am not aware of a FileMove() function native to AutoIT, so this is what I do:

Func _FileMove($Source, $Destination)
    FileWrite($Destination, FileRead($Source))
    FileDelete($Source)
    Return
EndFunc

Well, you're aware that this is very - veeery inefficient - right? Better use FileMove() because it doesn't write a complete file but instead just moves entries in the filesystem.
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
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...