Skip to content

Tag: copy

Copy a file from one directory to another in C++

I am writing a C++ program to copy one file from one directory to another. I don’t want to use C++ 17 features. I have already implemented this in the following code. I am on Linux and I want to use the OS cp command to do this. I have written this code. The error is: cp: source: No such

find and copy command not working in bash

This line works in the terminal, but not in a bash script: cd /home/me/Downloads/Data/$currentYear/$currentMonth/$currentDay/ find . -name ‘*.wav’ -exec cp {} $tempfolder ; I’m trying to copy all the WAVE files from all the sub-directories to a temporary folder Answer So, I solved it. Turns out, that the cd /home/me/Downloads/Data/$currentYear/$currentMonth/$currentDay/ was not actually changing the directory for the find .

Linux Command Line – list all directories containing .js files, and copy the directories and their contents to a new folder

Here is the code I already have that finds and lists all directories containing .js files (excluding the node_modules directory). As you can see, listing those directories is no problem. However, rather than list the directories, I would like to copy them (and their contents) to a new folder, preferably all in one line without running any kind of script.

Copying folders but not tar files in linux

I have a folder, which consists of many folders and many tar files. (this many is around 1000) I want to write a script to copy all folders with their contents to another directory, but I do not want to copy tar files. I already know by writing cp -a /source/ /path/ I can copy a directory with its contents