quicksilver Posted December 19, 2005 Share Posted December 19, 2005 (edited) Hi i wanted to Create a Tool that copy From a Folder like c:\temp to c:\backup where are many other Folders.. in this folders are txt files.. and i want to go into the first folder .. open the folder.. copy all the txt files into c:\backup.. the files in c:\backup get automaticly deleted.. now i had to check if the Folder c:\backup is empty.. is the folder c:\backup is empty i had to copy all the Files of the Next folder of c:\temp into c:\backup. again simply: in c:\temp are folders link c:\temp\12, c:\temp\13, c:\temp\2f2w, c:\temp\tger4 goto c:\temp\12 copy *.txt to c:\backup ... watch into c:\backup every 1 minute if its empty.. if not .. wait.. if its empty goto c:\temp\13 and copy *.txt to c:\backup..... Can Anyone help me?!? Edited December 19, 2005 by quicksilver Link to comment Share on other sites More sharing options...
randallc Posted December 19, 2005 Share Posted December 19, 2005 eh? wat? too hard to know what you want, I think... why is it all happening?... Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
quicksilver Posted December 19, 2005 Author Share Posted December 19, 2005 I want that the script copy the files to c:\backup.. if the backup folder is empty copy the contents of the next folder into c:\backup .. and again.. and again. Link to comment Share on other sites More sharing options...
Bert Posted December 19, 2005 Share Posted December 19, 2005 I'm happy to help, however, I'm not quite following you on what you want. Several questions: 1. is the data you are backing up staying on the same drive? 2. If I'm understanding you, you want to copy it, then delete it right away???? do you have any code that you tried doing this? The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
quicksilver Posted December 19, 2005 Author Share Posted December 19, 2005 No the files are not on the Same drive. Is this important? it is a network drive .. mapped to a local drive.Yes Copy and than delete the folder.No because i dont know how to list the folders and get the contents of it.I'm happy to help, however, I'm not quite following you on what you want.Several questions:1. is the data you are backing up staying on the same drive?2. If I'm understanding you, you want to copy it, then delete it right away????do you have any code that you tried doing this? Link to comment Share on other sites More sharing options...
quicksilver Posted December 20, 2005 Author Share Posted December 20, 2005 Nobody can help me ? Link to comment Share on other sites More sharing options...
MrSpacely Posted December 20, 2005 Share Posted December 20, 2005 Nobody can help me ?It seems to be a bit unclear wht you wantI understand there is a folder with textfiles and subfoldersyou want to copy all the textfiles per subfolder to a folder wich deletes themand wait until the delete folder is emptythe weird thing is you copy them to that folder so nothing happens.you copy files wich are deleted again so at the end nothing has changed.maybe you mean moving the files?But why don't just delete them instantly Link to comment Share on other sites More sharing options...
seandisanti Posted December 20, 2005 Share Posted December 20, 2005 Nobody can help me ?untested, but it should work, moves files to backup then sleeps 60 seconds. because it may take a few seconds to execute the function, you may end up with a slightly longer time between backups. pause key stops execution. HotKeySet("{PAUSE}","IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss") $tosearch = "C:\temp" while 1 RecFileSearch($tosearch) sleep(60000) WEnd Func RecFileSearch($current) Local $search = FileFindFirstFile($current & "\*.txt") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file)<1 Then ExitLoop FileMove($file,"c:\backup\") If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then RecFileSearch($current & "\" & $file) WEnd FileClose($search) EndFunc Func IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss() Exit EndFunc Link to comment Share on other sites More sharing options...
quicksilver Posted December 21, 2005 Author Share Posted December 21, 2005 (edited) Hm thank you for your help .. But i think it doesnt work i have tested it but nothing happend #include <Process.au3> #include <file.au3> $ini_file = @ScriptDir&"\settings.ini" $file = FileOpen($ini_file, 0) $source = FileReadLine($file,1) $destination = FileReadLine($file,2) FileClose($file) TrayTip("Started", "Folder: "&$source, 5, 1) TraySetState() TraySetToolTip("Copyfiles") HotKeySet("{PAUSE}","IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss") $tosearch = $source while 1 RecFileSearch($tosearch) sleep(60000) WEnd Func RecFileSearch($current) Local $search = FileFindFirstFile($current & "\*.txt") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file)<1 Then ExitLoop FileMove($file,$destination) If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then RecFileSearch($current & "\" & $file) WEnd FileClose($search) EndFunc Func IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss() Exit EndFunc to MrSpacely I want that the tool move all the files from folder a to folder b. But Only subfolder to subfolder.. not all files at the same time.. First all files in folder 1.. than wait until the backup folder is empty.. than folder 2.. wait until empty.. than folder 3... ... ... Edited December 21, 2005 by quicksilver Link to comment Share on other sites More sharing options...
seandisanti Posted December 21, 2005 Share Posted December 21, 2005 Hm thank you for your help .. But i think it doesnt work i have tested it but nothing happend #include <Process.au3> #include <file.au3> $ini_file = @ScriptDir&"\settings.ini" $file = FileOpen($ini_file, 0) $source = FileReadLine($file,1) $destination = FileReadLine($file,2) FileClose($file) TrayTip("Started", "Folder: "&$source, 5, 1) TraySetState() TraySetToolTip("Copyfiles") HotKeySet("{PAUSE}","IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss") $tosearch = $source while 1 RecFileSearch($tosearch) sleep(60000) WEnd Func RecFileSearch($current) Local $search = FileFindFirstFile($current & "\*.txt") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file)<1 Then ExitLoop FileMove($file,$destination) If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then RecFileSearch($current & "\" & $file) WEnd FileClose($search) EndFunc Func IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss() Exit EndFunc to MrSpacely I want that the tool move all the files from folder a to folder b. But Only subfolder to subfolder.. not all files at the same time.. First all files in folder 1.. than wait until the backup folder is empty.. than folder 2.. wait until empty.. than folder 3... ... ...if you're reading source and destination folders from a list as it appears by your code, then my approach is inefficient to say the least, but it should still work. if your folder names in the file have trailing backslashes, remove them, or remove the backslashes that my script adds. then it should work... Link to comment Share on other sites More sharing options...
quicksilver Posted January 9, 2006 Author Share Posted January 9, 2006 I've tested it again and nothing happend i've copied the script and created a ini with this text: c:\in c:\out but nothing happend ) Link to comment Share on other sites More sharing options...
seandisanti Posted January 9, 2006 Share Posted January 9, 2006 (edited) I've tested it again and nothing happend i've copied the script and created a ini with this text: c:\in c:\out but nothing happend )try this... #include <Process.au3> #include <file.au3> $ini_file = @ScriptDir&"\settings.ini" $file = FileOpen($ini_file, 0) $source = FileReadLine($file,1) $destination = FileReadLine($file,2) FileClose($file) TrayTip("Started", "Folder: "&$source, 5, 1) TraySetState() TraySetToolTip("Copyfiles") HotKeySet("{PAUSE}","IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss") $tosearch = $source while 1 RecFileSearch($tosearch) sleep(60000) WEnd Func RecFileSearch($current) Local $search = FileFindFirstFile($current & "\*.txt") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file)<1 Then ExitLoop If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then RecFileSearch($current & "\" & $file) FileMove($file,$destination) WEnd FileClose($search) EndFunc Func IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss() Exit EndFunc ***edit*** forgot to /code Edited January 9, 2006 by cameronsdad Link to comment Share on other sites More sharing options...
quicksilver Posted January 10, 2006 Author Share Posted January 10, 2006 hm dont know... im stupid :/ ? nothing happend.. i dont understand it... did you test it? Link to comment Share on other sites More sharing options...
ChrisL Posted January 10, 2006 Share Posted January 10, 2006 (edited) Make sure you have the ini file with the source path as the first line and the destination path as the second line. No trailing backslashes!! #include <Process.au3> #include <file.au3> $ini_file = @ScriptDir&"\settings.ini" $file = FileOpen($ini_file, 0) $source = FileReadLine($file,1) $destination = FileReadLine($file,2) FileClose($file) TrayTip("Started", "Folder: "&$source, 5, 1) TraySetState() TraySetToolTip("Copyfiles") HotKeySet("{PAUSE}","IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss") $tosearch = $source while 1 RecFileSearch($tosearch) sleep(60000) WEnd Func RecFileSearch($current) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file)<1 Then ExitLoop If not StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) then FileCopy($current & "\" & $file, $destination & StringTrimLeft ($Current, Stringlen ($Source)) & "\" & $File) If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then DirCreate ($destination & StringTrimLeft ($Current, Stringlen ($Source))& "\" & $File) RecFileSearch($current & "\" & $file) Endif WEnd FileClose($search) EndFunc Func IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss() Exit EndFunc Edited January 10, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
quicksilver Posted January 10, 2006 Author Share Posted January 10, 2006 (edited) ok now it works But it creates a folder .. but i only want to copy the files from the folder... all files with the end *.pdf, *.idx and *.rdy Edited January 10, 2006 by quicksilver Link to comment Share on other sites More sharing options...
ChrisL Posted January 10, 2006 Share Posted January 10, 2006 #include <Process.au3> #include <file.au3> $ini_file = @ScriptDir&"\settings.ini" $file = FileOpen($ini_file, 0) $source = FileReadLine($file,1) $destination = FileReadLine($file,2) FileClose($file) TrayTip("Started", "Folder: "&$source, 5, 1) TraySetState() TraySetToolTip("Copyfiles") HotKeySet("{PAUSE}","IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss") $tosearch = $source while 1 RecFileSearch($tosearch) sleep(60000) WEnd Func RecFileSearch($current) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file)<1 Then ExitLoop If not StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) then FileCopy($current & "\" & $file, $destination & "\" & $File) If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then RecFileSearch($current & "\" & $file) Endif WEnd FileClose($search) EndFunc Func IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss() Exit EndFunc [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted January 10, 2006 Share Posted January 10, 2006 There is possible a better way of filtering the file types but this will work I think expandcollapse popup#include <Process.au3> #include <file.au3> $ini_file = @ScriptDir&"\settings.ini" $file = FileOpen($ini_file, 0) $source = FileReadLine($file,1) $destination = FileReadLine($file,2) FileClose($file) TrayTip("Started", "Folder: "&$source, 5, 1) TraySetState() TraySetToolTip("Copyfiles") HotKeySet("{PAUSE}","IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss") $tosearch = $source while 1 RecFileSearch($tosearch) sleep(60000) WEnd Func RecFileSearch($current) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file)<1 Then ExitLoop If not StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) then if Stringright ($file, 3) = "pdf" or Stringright ($file, 3) = "idx" or Stringright ($file, 3) = "rdy" then FileCopy($current & "\" & $file, $destination & "\" & $File) Endif If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then RecFileSearch($current & "\" & $file) Endif WEnd FileClose($search) EndFunc Func IHopeImNotTheOnlyOneThatLaughsAtMyComicallyLongFunctionNamesImAnAss() Exit EndFunc [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
quicksilver Posted January 10, 2006 Author Share Posted January 10, 2006 Hm ok thanks. Nice Script. But I,ve got 4 folders .. and he copy 3 of the 4 folders.. but he had to wait after the first Link to comment Share on other sites More sharing options...
ChrisL Posted January 10, 2006 Share Posted January 10, 2006 can you explain that a bit better.. 4 sub folders? Wait after what? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
quicksilver Posted January 10, 2006 Author Share Posted January 10, 2006 Ok source folder "in" Destination folder "out" folder names are variable.. examples LP_2000_n n is a wildcard from 1 to x folders: in\LP_2000_01\ files in it bla_n.txt bla_n.rdy bla_n.pdf bla_n.idx in\LP_2000_02\ files in it bla_n.txt bla_n.rdy bla_n.pdf bla_n.idx in\LP_2000_03\ files in it bla_n.txt bla_n.rdy bla_n.pdf bla_n.idx in\LP_2000_04\ files in it bla_n.txt bla_n.rdy bla_n.pdf bla_n.idx out is empty now the script had to copy *.rdy, *.pdf, *.idx into the out folder from the first folder (LP_2000_01) if the out folder is empty.. after a time intervall the out is empty again.. no the script had to copy all the files from the second folder(LP_2000_02). When it is more easy we can move the folder which has ben copied here LP_2000_01 into a backup folder. Ok? 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