Sign in to follow this  
Followers 0
svatvn

copy whole content of a folder to another folder

8 posts in this topic

Hi,

I want to copy the whole content of a folder to another folder with AutoIT

The code for batch would be like this:

start /w XCOPY "%CD%\Copy\*.*" "C:\" /S /I /C /H /R /Y /E

so how is the code for AutoIT - without using xcopy - to copy the content?

thanks

Share this post


Link to post
Share on other sites



svatvn,

Look at DirCopy in the Help file. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You could just use _RunDOS() but here:

FileCopy(@ScriptDir & "*.*", "C:", 8)

Will do what you're asking.

Edit: Fixed the command.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

hi

wow, thanks for the fast answer.

@melba

I don't know, how to copy the content of a folder (including files and subfolders)

DirCopy only copy one single folder right?

@rcmaehl: the code is what I need, unfortunately it only copies files, not folders....

so how can I tell the command, to copy folders too? (the complete content)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

hi

wow, thanks for the fast answer.

@melba

I don't know, how to copy the content of a folder (including files and subfolders)

DirCopy only copy one single folder right?

@rcmaehl: the code is what I need, unfortunately it only copies files, not folders....

so how can I tell the command, to copy folders too? (the complete content)

The 8 at the end of FileCopy should make it copy folders too. However, DirCopy can copy more than one folder.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

svatvn,

DirCopy copies a folder and all the subfolders and files within it. If you want to copy several separate folders without the lower level subfolders, then FileCopy is the way to go - although you will have to call it for each folder. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

well, is it me or

FileCopy(@ScriptDir & "*.*", "C:", 8)

doesnt copy folders...?

so, how can I tell DirCopy to copy the folders of an folder?

start /w XCOPY "%CD%Copy*.*" "C:" /S /I /C /H /R /Y /E

does exactly what I want (copy the complete content of a folder to another folder. I don' know why it is so complicated in AutoIT... :)

Share this post


Link to post
Share on other sites

svatvn,

I don' know why it is so complicated in AutoIT

It is not...... :D

One more time:

FileCopy copies the files of a folder - it does not copy subfolders, nor the files within them.

DirCopy copies the whole tree - all files, subfolders, and the files within them.

So to match XCopy you need DirCopy. :)

Have you even looked at the Help file? On the first line of the DirCopy page you can see: "Similar to xcopy". :)

Now go and try those 2 commands for yourself - as I did to check before I wrote the post above - and see how they differ. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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