Jump to content

Help with moving of files


 Share

Recommended Posts

I got no clue on how to do this or even how to get started.

I dont even know if autoit can do this but this is what i need help getting done with.

I need to somehow be able to move all the files with numbers behind them into another directory

so all thats left when the files are done being moved is just the files with no number behind them.

For Example. (please click to view full image to better understand)

Posted Image

Link to comment
Share on other sites

Hi,

i think the good old regular expressions may help in this case. try this one out

CODE
$file = "Blockhouse_5"

; Now check whether or not its a file with _ and number

If StringRegExp($file,"^.*_\d$",0) Then

Msgbox(0,"Found","Moving file " & $file)

EndIf

$file = "Some_other_File_X"

; Now check whether or not its a file with _ and number

If Not StringRegExp($file,"^.*_\d$",0) Then

Msgbox(0,"Found","Not moving file " & $file)

EndIf

The regular expression "^.*_\d$" means:

Check if my string has any characters (.*) from the beginning (^) and the last 2 chars are "_" and exactly one digit (\d) right before the end ($) of my string.

the rest of your question can be solved with FileFindFirstFile

Regards,

Dschingis

Edited by Dschingis
Link to comment
Share on other sites

Search the helpfile for:

FileMove

FileFindFirstFile

StringRight

or

StringMid

Begin with FileFindFirstFile()

It't got a good example script with it which you may edit to your needs like FileMove the files when StringRight or StringMid detect a number. (Take notice that with StringRight fileextensions are seen. So, StringTrimLeft($file, StringLen($file) - 4) gives you the filename without a 3 letter extension with point.)

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

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...