Sign in to follow this  
Followers 0
Sam31

Search file and move

8 posts in this topic

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

Share this post


Link to post
Share on other sites



I find if stringleft function but my prob is the search function

Share this post


Link to post
Share on other sites

Ok finally it's not necessary to do anything special: "Filemove" function that all I need.

Share this post


Link to post
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.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

Oh, so there is actually a command for that? Didn't come up in my scite calltips. I better check that out.

Share this post


Link to post
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
Sign in to follow this  
Followers 0