Saturday, October 8, 2022

[SOLVED] Ubuntu copying files inside a folder to a new folder

Issue

I want to copy the contents of a folder ( not the folder itself) to another folder in ubuntu. Is there anyway to do it with cp command? cp always also move the source folder too


Solution

To move contents of a folder to another in Linux systems the simplest way to do that is to use cp command.

1, Example of coping all contents that are in the oldFolder to the newFolder

cp -r ./oldFolder/* ./newFolder/

2, Copy only one file from the oldFolder to newFolder

cp -r ./oldFolder/file.txt ./newFolder/



Answered By - Abass Dev
Answer Checked By - Marie Seifert (WPSolving Admin)