I am trying to copy files from one folder to another folder using Gulp:
gulp.task('move-css',function(){ return gulp.src([ './source/css/one.css', './source/other/css/two.css' ]).pipe(gulp.dest('./public/assets/css/')); });
The above code is copying one.css
& two.css
to the public/assets/css
folder.
And if I use gulp.src('./source/css/*.css')
it will copy all CSS files to the public/assets/css
folder which is not what I want.
How do I select multiple files and keep the folder structure?
var copy = require('gulp-copy'); gulp. task('copy-resources', function() { return gulp. src('./src/img/*. png') .
To do this, click and hold your left mouse button on the top-left portion of where you want to start highlighting. Next, drag the box until the last file or folder is highlighted. Once the files are selected, they can be copied, cut, or dragged to another window to move them.
Step 1: Click on the first file to be selected. Step 2: Hold down Ctrl and click on all the files that you want to select additionally. Step 2: Press the Shift key and click on the last file. Step 3: You have now selected all files at once and can copy and move them.
Drag & drop makes it incredibly easy to copy or move files and folders. If you need to copy a file to multiple folders, you can hold down the Ctrl key, and drag the file or folder on to each folder you want to copy it to.
Copy Specific File Types While Keeping Directory Structure In Linux If --parents option doesn't work, you can combine find command with cpio command to copy files keeping directory structure. $ find. -name '*.mp3' | cpio -pdm ~/ostechnix
Initially it could be a copy and paste by hand but this becomes very repetitive, but with ' gulp ' this can be made an automatic process every time you update the 'dist' folder. Now this tutorial is based on you already having knowledge of setting up projects via ' npm ' for example using frameworks such as ' angular ', ' vuejs '.
With the Xcopy feature in Windows 10, folder structures can be copied and pasted out of the way with an easy-to-use shortcut. Can You Copy A Folder Structure Without Files? We recommend copying the entire folder structure without copying files that have already been selected for the new financial year (tip).
Copy files will not have to be duplicated, however, when copying folder structures you may need to repeat them with Xcopy. With the Xcopy feature in Windows 10, folder structures can be copied and pasted out of the way with an easy-to-use shortcut.
To achieve this please specify base
.
¶ base - Specify the folder relative to the cwd. Default is where the glob begins. This is used to determine the file names when saving in
.dest()
In your case it would be:
gulp.task('move-css',function(){ return gulp.src([ './source/css/one.css', './source/other/css/two.css' ], {base: './source/'}) .pipe(gulp.dest('./public/assets/')); });
Folder structure:
. ├── gulpfile.js ├── source │ ├── css │ └── other │ └── css └── public └── assets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With