grunewald6 Posted April 4, 2009 Share Posted April 4, 2009 Is there a way to exclude certain filetypes in a dir copy? For example, excluding .mpg or .mp3 files when copying My Docs? TIA Link to comment Share on other sites More sharing options...
Authenticity Posted April 4, 2009 Share Posted April 4, 2009 Don't think so, but you can code different file copy. For example, you can recursively build an array of files and keep out files with .mpg extension and copy them all, one by one. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 4, 2009 Moderators Share Posted April 4, 2009 xcopy has an EXCLUDE feature, run this to see your command line options:Run(@ComSpec & " /k xcopy /?", "", @SW_SHOW) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
maqleod Posted April 4, 2009 Share Posted April 4, 2009 (edited) Is there a way to exclude certain filetypes in a dir copy? For example, excluding .mpg or .mp3 files when copying My Docs? TIA something like: #Include <File.au3> $yourpath = "C:\" $dest = "E:\" $files = _FileListToArray($yourpath,'*.*',1) for $i = 1 to $files[0] if StringRight($files[$i],3) <> "mpg" then ;don't copy files with .mpg extension FileCopy($yourpath & $files[$i], $dest & $files[$i],1) endif next Edited April 4, 2009 by maqleod [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
zfisherdrums Posted April 4, 2009 Share Posted April 4, 2009 (edited) Is there a way to exclude certain filetypes in a dir copy? For example, excluding .mpg or .mp3 files when copying My Docs? TIA Try good ol' xcopy with the EXCLUDE option set. It is a DOS command that should handle all the heavy lifting for you. For example,: xcopy "c:\source" "c:\destination" /EXCLUDE:excludes.txt where excludes.txt contains the following entry: .mp3 This would copy all files from "c:\source" to "c:\destination", but would exclude all files with extensions matching ".mp3". You could wrap this call inside of the _RunDos UDF. For more info on xcopy, check here or open a DOS console and enter 'xcopy /?'. Hope this helps! Zach... EDIT: corrected misuse of argument. Edited April 4, 2009 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
grunewald6 Posted April 5, 2009 Author Share Posted April 5, 2009 Thanks, guys. Xcopy seems to be the way to go. I miss the forest for the trees sometimes - forgetting DOS and always looking for an autoit command. Thanks again! 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