1

I want to copy all the images from one folder to another. I have tried this !cp -r /content/COVID-19\ Radiography\ Database/COVID-19 /data

but this creates a folder COVID-19 in the data folder, and I don't want to create COVID-19 folder in data, instead, I want to copy images directly.

EDIT This command copying all files but in COVID-19 folder which is in data folder. i want them directly in data folder

3 Answers3

3

Try using a wildcard to grab everything in the folder.

!cp -r /content/COVID-19\ Radiography\ Database/COVID-19/* /data

The original command is interpreted as copy this folder (COVID-19) to folder /data. The wildcard will say to take all of the files in that folder and copy them to /data.

Robby1212
  • 880
3
cp -a /source/. /dest/

-a is for recursive copy and . at the end is for copying the hidden files too.

0

This code with Flag "-R" copies perfectly all the contents of "folder1" to existing "folder2":

cp -R folder1/. folder2

Flag "-R" copies symbolic links as well but Flag "-r" skips symbolic links so Flag "-R" is better than Flag "-r".

  • The latest GNU Grep 3.7:
-R, --dereference-recursive

For each directory operand, read and process all files in that directory, recursively, following all symbolic links.

-r, --recursive

For each directory operand, read and process all files in that directory, 
recursively. Follow symbolic links on the command line, but skip symlinks 
that are encountered recursively. Note that if no file operand is given, 
grep searches the working directory. This is the same as the 
‘--directories=recurse’ option.