Sign in to follow this  
Followers 0
agent47

How to move large set of files from the text file

6 posts in this topic

Hello Everyone,

I am new to AutoIt scripts i have a doubt in moving a files,Kindly can anyone help me to find the solution for the problem

Problem:

I have a txt file in which i have a file list and i want to move multiple files by creating a new folder with name so how can it be done

eg - a contents in the File.txt

C:\songs\4.mp3

C:\songs\10.mp3

C:\songs\6.mp3

C:\songs\12.mp3

C:\songs\94.mp3

C:\songs\6.mp3

I want the files to be moved like below contents

A contents of the second file2.txt

C:\songs\s1\4.mp3

C:\songs\s2\10.mp3

C:\songs\s3\6.mp3

C:\songs\s4\12.mp3

C:\songs\s5\94.mp3

C:\songs\s6\76.mp3

I want to move [4.mp3] to [s1] by creating a new folder[s1] from [songs] folder

1.I want to move all the files simultaneously

kindly help thnx

Share this post


Link to post
Share on other sites



_FileReadToArray first text file

_FileReadToArray second text file

For $i=1 To ... number of elements in the array

FileMove

Next

Good luck,


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

_FileReadToArray first text file

_FileReadToArray second text file

For $i=1 To ... number of elements in the array

FileMove

Next

Good luck,

Thank you

whether it is applicable for large set of files about 500 to 1000 files

can you explain the above logic with a code or example so it will be usefull to me.

Thanks once again

Share this post


Link to post
Share on other sites

Did you read anything about _FileReadToArray or FileMove ? Have you tried anything so far?

Of course it can work with ANY number of files.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Did you read anything about _FileReadToArray or FileMove ? Have you tried anything so far?

Of course it can work with ANY number of files.

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

Share this post


Link to post
Share on other sites

First: the files you attached here are not consistent with the example you gave in the first post; it is ahard to understand what you want from these files, so I have used your first post as example.

Second: you will notice that there were many more bugs ;) but I can see that you have tried something so I decided to help.

Third: read again about _FileReadToArray (return, syntax and example) and also read about arrays. If you don't try to understand how to do it by yourself you will become a permanent client of this section of the forum and all you'll do is to ask always for help.

#include <file.au3>
#include <Math.au3>

Dim $aArray, $path, $path1, $fila, $filo

$path="c:\rpt.txt"
$path1="c:\rpt1.txt"
_FileReadToArray($path, $fila)      ;read again about _FileReadToArray, return and syntax
If @error  Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
_FileReadToArray($path1,$filo)
If @error Then
      MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

For $i = 1 to _Min(Ubound($fila)-1, Ubound($filo)-1)        ;read about arrays and Ubound
   FileMove($fila[$i],$filo[$i],9)
   MsgBox(0,"Info","File moved from "&$fila[$i]&" to "&$filo[$i])
Next

You may want to test it first for a smaller number of files; build 2 files with a couple lines and use that to test. Once the test is OK you can use the big files.

Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.

Chinese Proverb


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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