Jump to content

copy whole content of a folder to another folder


svatvn
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

svatvn,

Look at DirCopy in the Help file. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
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)

Link to comment
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)

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

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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... :)
Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...