Score:0

How to copy all the files inside the directory to another folder inside the directory with terminal?

br flag

I copy the files inside a folder to another folder inside the directory like this :

cp -a folderone/ foldertwo

Now how can I copy all the files in the directory to foldertwo in the directory ?

Score:1
ng flag

You must use either relative or absolute paths on your target folder (assuming you are currently at the origin folder).

For calling folders names relative to your current path you use ../ to go up one level.

Absolute paths are a sure shot. Type / on the target folder and press tab (autocomplete is your friend) and keep autocompleting till you create the full path for your folder.

Most likely, you will be working with files on your home. You can use ~/ to reference the root of your home folder. So do ~/ and use tab to autocomplete your path (you can do it for source and target folder, if you don't want to cd to either of those folders)

Mahdi Faraji avatar
br flag
```cp -a ../name/ dest``` I ran this and it worked but it goes into a loop and copies the files to the dest folder over and overagain so If I go to dest folder there is another dest folder inside it and it goes on and on . How can I copy files once only ?
bac0n avatar
cn flag
`cp -T source dest`
Mahdi Faraji avatar
br flag
@bac0n It throws an error : ```illegal option -- T usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory ```
bac0n avatar
cn flag
then this does not sound like ubuntu, macos?
Nate T avatar
it flag
Also `cp /name/* dest/` works. That's what I generally use.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.