Jump to content

copy all the files inside of a directory with subd


hebi
 Share

Recommended Posts

I didnt think I should have to point it out but how about DirCopy???

*** Matt @ MPCS

<{POST_SNAPBACK}>

not the dir itself only the content of a directory

like this:

cp -R C:/dummy/* C:/dummy/

Edited by hebi
Link to comment
Share on other sites

If you have a tree that looks like this:

/

-etc

--subfolder

---subfile1

--file1

-etc2

and you execute the command cp -R /etc /etc2 do you expect the new tree to look like:

/

-etc

--subfolder

---subfile1

--file1

-etc2

--subfolder

---subfile1

--file1

or:

/

-etc

--subfolder

---subfile1

--file1

-/etc2

--file1

--subfile1

?

*** Matt @ MPCS

Link to comment
Share on other sites

Ok there is not a command... you can use windows copy using the runwait function... or manipulate the script on this thread to get what you are looking for.

*** Matt @ MPCS

EDIT: fixed link

<{POST_SNAPBACK}>

um, why not FileCopy("C:\dir1\*.*", "C:\dir2\*.*") ? FileCopy will copy directories.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

i did something like the runwait command too

$destination = StringFormat("%s",$instpath)
$source = StringFormat("%s\Server",$source)
$command = StringFormat("xcopy %s %s /E /M",$source,$destination)
RunWait($command)

but the problem is:

IT's not working when one of the paths has a space in it

C:\My Documents <-will not work..

this drives me sad because i cant add some " in the code :)(

Link to comment
Share on other sites

  • Developers

ok: i want to copy the content (with all subdirs and trees and blah) of direcotry A to direcotry B

in unix:

cp -R /dummy/* /dummy2/

<{POST_SNAPBACK}>

like

Xcopy c:\dummy\*.* c:\dummy2 /s

or

Dircopy("c:\dummy" ,"c:\dummy2",1)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

read above

<{POST_SNAPBACK}>

saw that after the post... however:

Dircopy("C:\My Documents\source" ,"C:\My Documents\target",1)

should work...

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

i did something like the runwait command too

$destination = StringFormat("%s",$instpath)
$source = StringFormat("%s\Server",$source)
$command = StringFormat("xcopy %s %s /E /M",$source,$destination)
RunWait($command)

but the problem is:

IT's not working when one of the paths has a space in it

C:\My Documents <-will not work..

this drives me sad because i cant add some " in the code :)(

<{POST_SNAPBACK}>

if something doesn't work because it has a space in the path, what do you do? put quotes around it. It has to do with FAQ 7

I don't know what you're doing with the string format, but here's how I'd do it...

runwait( @comspec & ' /c xcopy "' & $source &  '" "' & $destination & '" /E /M')

that will put double quotes around the souce and the destination.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

saw that after the post...  however:

Dircopy("C:\My Documents\source" ,"C:\My Documents\target",1)

should work...

<{POST_SNAPBACK}>

being as I'm to lazy to test, I believe that would result in "c:\my documents\target\source" not the contects of \source within target directly...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

  • Developers

being as I'm to lazy to test, I believe that would result in "c:\my documents\target\source" not the contects of \source within target directly...

<{POST_SNAPBACK}>

don't think so.... :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...