Chris_1013 Posted September 7, 2004 Share Posted September 7, 2004 I'm trying to achieve one of two things. Simply, I want to be able to copy a whole directory with all it sub-folders and files to another. I assume this is possible with the FileCopy command in AutoIt, but do you think I can work out the syntax? Can anyone give me a pointer on this? The second thing is, I'd like to do this, but rather than getting a result at the end as to whether the whole thing completed or failed, what happened with each individual file. I assume this would work in, get a list of files in dir (and sub-dirs), copy each one, and log the result. Can anyone get me started on this either? Cheers Chris Link to comment Share on other sites More sharing options...
ezzetabi Posted September 7, 2004 Share Posted September 7, 2004 This not so easy Larry script enumerate all folders and subfolders starting from where you want. If you modify it a little you can easily have a list of file and and folders inside two $vars. When you have this, create the folders and copy the files.http://www.autoitscript.com/forum/index.php?showtopic=4602 Link to comment Share on other sites More sharing options...
Chris_1013 Posted September 7, 2004 Author Share Posted September 7, 2004 It's a pity if it's more complex. I suppose I could cheat and just call a DOS copy, but it seemed like I should be able to do it in AutoIt. I would need a search first to do file-by-file copy though. Link to comment Share on other sites More sharing options...
ezzetabi Posted September 7, 2004 Share Posted September 7, 2004 Why the Larry script do not help you? Sorry I dont understand. Link to comment Share on other sites More sharing options...
Valik Posted September 7, 2004 Share Posted September 7, 2004 Any reason DirCopy doesn't do what you want...? Link to comment Share on other sites More sharing options...
Chris_1013 Posted September 7, 2004 Author Share Posted September 7, 2004 There's a DirCopy? Link to comment Share on other sites More sharing options...
ezzetabi Posted September 7, 2004 Share Posted September 7, 2004 (edited) DirCopy doesn't allow coping a item per time. Does it? Edit: typo Edited September 8, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
Chris_1013 Posted September 8, 2004 Author Share Posted September 8, 2004 No it doesn't, I knew I'd have to code my own solution around this, but this isn't very important as it's unlikely to fail. At first I just wanted a way to copy the whole directory, and DirCopy shall fit nicely :-) Link to comment Share on other sites More sharing options...
ezzetabi Posted September 8, 2004 Share Posted September 8, 2004 Grrr... Time wasted. :| Link to comment Share on other sites More sharing options...
Chris_1013 Posted September 8, 2004 Author Share Posted September 8, 2004 Woah, soooooorry!!! Link to comment Share on other sites More sharing options...
Valik Posted September 8, 2004 Share Posted September 8, 2004 Grrr... Time wasted. :| <{POST_SNAPBACK}>Nobody to grrr at except yourself. You could of just as easily mentioned DirCopy as I did. Link to comment Share on other sites More sharing options...
ezzetabi Posted September 8, 2004 Share Posted September 8, 2004 Well. I knew that DirCopy dont allow copy one item per time! Thats why I pointed him to Larry script! Grrrr... And anyway, that GRRR is only a joke. Said smiling! Link to comment Share on other sites More sharing options...
Valik Posted September 8, 2004 Share Posted September 8, 2004 Well. I knew that DirCopy dont allow copy one item per time! Thats why I pointed him to Larry script! Grrrr... And anyway, that GRRR is only a joke. Said smiling! <{POST_SNAPBACK}>Look at what they want to do, not how they want to do it. They wanted to copy a directory. Sure, they might have wanted to do it one item at a time, but it's better to confirm that is in fact the goal by pointing out there is a better way first and seeing what the response is. Link to comment Share on other sites More sharing options...
ezzetabi Posted September 8, 2004 Share Posted September 8, 2004 Maybe... But it actually seems that you dont read the posts sometime. Link to comment Share on other sites More sharing options...
SlimShady Posted September 8, 2004 Share Posted September 8, 2004 Maybe... But it actually seems that you dont read the posts sometime. <{POST_SNAPBACK}>Not Valik, you! Did you read this sentence: Simply, I want to be able to copy a whole directory with all it sub-folders and files to another. Link to comment Share on other sites More sharing options...
ezzetabi Posted September 8, 2004 Share Posted September 8, 2004 YOU AND VALIK! The second thing is, I'd like to do this, but rather than getting a result at the end as to whether the whole thing completed or failed, what happened with each individual file. I assume this would work in, get a list of files in dir (and sub-dirs), copy each one, and log the result. Link to comment Share on other sites More sharing options...
Valik Posted September 8, 2004 Share Posted September 8, 2004 Think about this for half a second ezzetabi. DirCopy() returns 1 on success, 0 on failure. There is absolutely no need to worry about each individual file and go through all that checking stuff. If a file/directory wasn't copied okay, DirCopy() will return 0 to signify failure. It would only be necessary to check each individual file if each individual file was moved via FileCopy(). Link to comment Share on other sites More sharing options...
ezzetabi Posted September 8, 2004 Share Posted September 8, 2004 It was a Chris_1013 problem not mine. Also I thought that he/she wanted to copy each individual file for making a very detailed log where he/she could read exatly what files were missing... or who knows? But... Who cares? Thanks Valik for solving the problem. Next time I'll answer: RTFM or use SEARCH! as Chris_1013 deserved since the begin! Link to comment Share on other sites More sharing options...
this-is-me Posted September 8, 2004 Share Posted September 8, 2004 Ok... everybody simmer down. There was a misunderstanding and a misstating with both parties concerned, but there is no reason to go finger-pointing because both made mistakes or misstated. Laying blame will only make both (all three?) people upset, and can lead to no good end. Who else would I be? Link to comment Share on other sites More sharing options...
Chris_1013 Posted September 9, 2004 Author Share Posted September 9, 2004 RTFM or use SEARCH! as Chris_1013 deserved since the begin! <{POST_SNAPBACK}>Terribly sorry for the trouble I've caused you chaps. Was a simple mis-understanding. How foolish of me to assume FileCopy didn't work for directories. I wrongly assumed that a command to copy files would be all inclusive such as the 'copy' command on a command line. Simple fault of mine to miss the DirCopy commmand. A thousand apologies for any distress caused to any of you. 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