1

I created a grunt copy task in with the below settings

{expand: true, src: ['E:\\Temp\\Copy1\\*'], dest: 'E:\\Temp\\Copy2\\', filter: 'isFile'},

I get the following error. how to I copy from absolute path?

Warning: Unable to create directory "E:\Temp\Copy2\E:" (Error code: ENOENT). Used --force, continuing.

kumar
  • 8,207
  • 20
  • 85
  • 176

1 Answers1

1

You need to use the cwd option, as the matches for the src glob are appended to the dest path.

If you want to copy the contents of E:\\Temp\\Copy1\\ to E:\\Temp\\Copy2\\, you can do it like this:

{
  expand: true,
  cwd: 'E:\\Temp\\Copy1\\',
  src: ['*'],
  dest: 'E:\\Temp\\Copy2\\',
  filter: 'isFile'
}

The Grunt documentation explains how the cwd and src options can be used to work with files:

  • cwd All src matches are relative to (but don't include) this path.
  • src Pattern(s) to match, relative to the cwd.
  • dest Destination path prefix.
cartant
  • 57,105
  • 17
  • 163
  • 197