Sycom Posted April 14, 2008 Share Posted April 14, 2008 I have a massive amount of files that I am trying to put into a certain directory structure. I have the file names in one text file and the directory name in the other. I am trying to read from both files and then move the corresponding file to the correct directory. The script is creating the directory structure fine, but it is not moving the files. Can someone check out this script and see what I am doing wrong. Thank you expandcollapse popup$dirlist = FileOpen("D:\termed041408\testdir.csv", 0) $filelist = FileOpen("D:\termed041408\testlist.csv", 0) $errorflag = 0 ; Check if file opened for reading OK If $dirlist = -1 Then MsgBox(0, "Error", "Unable to open directory file.") Exit EndIf If $filelist = -1 Then MsgBox(0, "Error", "Unable to open list of files.") Exit EndIf While 1 $Dline = FileReadLine($dirlist) If @error = -1 Then ExitLoop $Pline = FileReadLine($filelist) DirCreate ("D:\termed041408\temp\" & $Dline & "\E-mail Data") DirCreate ("D:\termed041408\temp\" & $Dline & "\PC Drive Data") DirCreate ("D:\termed041408\temp\" & $Dline & "\Fileserver Data\H Drive") DirCreate ("D:\termed041408\temp\" & $Dline & "\Fileserver Data\Y Drive") FileMove ("D:\termed041408\temp\" & $Pline, "D:\termed041408\temp\" & $Dline & "\E-mail Data") ;If @error = -1 Then ExitLoop Wend FileClose($file) FileClose($filelist) Link to comment Share on other sites More sharing options...
spudw2k Posted April 14, 2008 Share Posted April 14, 2008 make sure the file actually exists. at D:\termed041408\temp\$pline destination. Check out the FileExists() func if you wanna add some error checking. Also, not a Big deal, but at the end you do a FileClose($file), I think you mean FileClose($dirlist) Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Sycom Posted April 15, 2008 Author Share Posted April 15, 2008 make sure the file actually exists. at D:\termed041408\temp\$pline destination.Check out the FileExists() func if you wanna add some error checking. Also, not a Big deal, but at the end you do a FileClose($file), I think you mean FileClose($dirlist)Awesome thank you very much. The FileExists() Func allowed me to figure out that I was pointing into the wrong directory. I have it fixed now... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now