Jump to content

moving txt files using array


agent47
 Share

Recommended Posts

hi thnx,

I was trying on the code and i am not able to perform the operation so can u kindly fix a bug in my code

#include <file.au3>
Dim $aArray
Dim $path
Dim $path1
Dim $i
Dim $fila
Dim $filo
$path="c:\rpt.txt"
$path1="c:\rpt1.txt"
$fila=_FileReadToArray($path,$aArray)
If @error  Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
$filo=_FileReadToArray($path1,$aArray)
If @error Then
      MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
$aArray=$aArray[$i]
 For $i = 1 to 10
   $aArray = FileMove($fila,$filo & "\",8)
Next
FileClose($fila)
FileClose($filo)
MsgBox(0,"File","moved")

Kindly help with this

thnx

rpt.txt

rpt1.txt

Link to comment
Share on other sites

Hi,

try this:

#include <file.au3>
Local $path="c:\rpt.txt"
Local $path1="c:\rpt.txt"
Local $i
Dim $fila
Dim $filo
_FileReadToArray($path,$fila) ; reading c:\rpt.txt into array
If @error  Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
_FileReadToArray($path1,$filo) ; reading c:\rpt1.txt into array
If @error Then
      MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $i = 1 to UBound ($fila) - 1
    $split = StringSplit ($fila [$i], "\") ; get mp3 file name, last value from array $split is filename
    FileMove($fila [$i],$filo [$i] & "\" & $split [UBound ($split) - 1],8)
    MsgBox (0,"File moved", $fila [$i] & @CRLF & $filo [$i] & "\" & $split [UBound ($split) - 1])
Next
;MsgBox(0,"File","moved")

;-))

Stefan

Link to comment
Share on other sites

Hi,

try this:

#include <file.au3>
Local $path="c:\rpt.txt"
Local $path1="c:\rpt.txt"
Local $i
Dim $fila
Dim $filo
_FileReadToArray($path,$fila) ; reading c:\rpt.txt into array
If @error  Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
_FileReadToArray($path1,$filo) ; reading c:\rpt1.txt into array
If @error Then
      MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $i = 1 to UBound ($fila) - 1
    $split = StringSplit ($fila [$i], "\") ; get mp3 file name, last value from array $split is filename
    FileMove($fila [$i],$filo [$i] & "\" & $split [UBound ($split) - 1],8)
    MsgBox (0,"File moved", $fila [$i] & @CRLF & $filo [$i] & "\" & $split [UBound ($split) - 1])
Next
;MsgBox(0,"File","moved")

;-))

Stefan

Hey, Many Thanks it is working
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...