Questions tagged [cp]

Questions relating to the Linux 'cp' command.

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

simple cp command problem “ i try to copy only ”

cp: 'test.txt' and 'test.txt' are the same file asadzoot@asadzoot-Vostro-14-3468:~/cnc/q1$ cp test.txt home/asadzoot/cnc/q1/ cp: cannot create regular file 'home/asadzoot/cnc/q1/': No such file or ...
0
votes
1answer
53 views

Copy all files from one folder to another in linux

I want to copy only files not folders from one folder to another in linux. I am using the following command cp sourceDir/* destDir The above command does copy all files to destDir but the command ...
0
votes
2answers
52 views

Copying a list of test/path/to/files to list of prod/path/to/files

I would like to copy a list of files in the form test/path/to/file/filename.xyz to their corresponding production path prod/path/to/file/filename.xyz. If the test path and the prod path are the same ...
2
votes
3answers
173 views

How to copy 12GB file from Ubuntu 19.10 to Android if My RAM size is 8GB

I tried different options to copy a 12GB movie from Ubuntu to Android (connected as a Camera for reliable connection, with mtp situation even worse), but surprisingly for me there is a RAM+SWAP ...
0
votes
0answers
29 views

16.04: Copy data from failing HDD which had Windows 10 Pro installed

I have a failing HDD from a Windows 10 Pro installation. I have mounted it Read Only on my Ubuntu 16.04 computer. I need to know the best command line syntax (procedure) to copy all data still ...
0
votes
1answer
55 views

simple question cp (command) [duplicate]

my problem is ''cp'' command I can't understand why I can't copy a simple text file for example: I have on the desktop two files "fis1" and "fis2" and in "fis1" I have "perfect" (text file) and I ...
5
votes
2answers
799 views

sh alternative to bash cp {file,file}

In a script, if I put #!/bin/bash at the top, this will work fine: cp directory/{foo,bar} destination However, with sh, this will give the error 'no such file or directory'. In sh, is there another ...
2
votes
3answers
229 views

Copy over a large number of files with new names

I have a large number of files (tens of thousands) I need to copy over from /dir1 to /dir2 but the name of the file must change as such: OLD NAME ---> NEW NAME filename.txt ---> bob_filename_1253....
-1
votes
1answer
48 views

script to copy multiple files from multiple directories to one of the folder/directory

I'm having five different directories in the home path which contain some files in all directories, as shown below. home/dir1 contains: abc121219.txt kucj.txt gtuj120518.txt gdkmcg.txt such.txt ...
0
votes
1answer
75 views

Copy all files from subdirectories and subsubdirectories to main directory with modifying file names by adding prefix of all parent directories

Following these two posts: Move files to parent directory, prefixing file name with former subdirectory name recursively add directory name to file name I would like to do the same but with copying ...
1
vote
2answers
619 views

How can I copy the contents of a child folder to its parent folder using command line?

I have this directory structure: parent_folder/child_folder/ I want to copy the contents of the child folder to the parent folder, but I don't know how to do it with cp.
-2
votes
1answer
48 views

Copy files such that individual files gets copied to the folder having file name as a string within complete folder name [closed]

I am using Cygwin as Linux shell, I have following contents in my current working directory: Files : Abc.dat 123.dat 456.dat Directories: W_Abc_w W_123_w W_456_w Now I want to copy files as ...
2
votes
2answers
504 views

trying to CP a directory to /dev/null

What I'm really tring to do, it verify the the data on an external drive is still readable. I thought the simplest and surest way to do this would be to copy everything to /dev/null. It works great ...
1
vote
0answers
185 views

Does copying files from EXT4 filesystem to NTFS lose permissions?

I recently attempted to back up my /home/user directory while removing ecryptfs from my system. I didn't have enough space on my Ubuntu EXT4 SSD so, not thinking, I used sudo cp -rp /home/user /media/...
0
votes
0answers
29 views

How to copy some lines from old folder after using ls to new blank file [duplicate]

My old folder has this output when I ls -lh drwxr-xr-x 2 ahmet sistem 4,0K Eyl 17 22:33 ahmet drwxr-xr-x 2 ali sistem 4,0K Eyl 20 16:08 ali drwxrwxr-x 2 hexcake hexcake 4,0K Eyl 13 18:57 ...
0
votes
1answer
43 views

How to copy files from a certain range into another directory from terminal?

I want to copy files 50,000 to 100,000 into a separate directory and I'm not sure how to go about doing this. For more context, I want to create a smaller dataset of images (50,000) from a larger ...
1
vote
2answers
147 views

How to replace cp command with wget?

I am very newbie to linux and its commands. What I want is use cp command instead of wget to request from browser. Because I'm using docker and the mongo site filtered our country's IP. I have ...
6
votes
1answer
2k views

How can I copy a directory without copying a specific file or subdirectory in terminal?

I have a directory main_dir which contains lots of files and 3 subdirectories (dir1 and dir2 and dir3). I want to copy it to another location without copying dir2 in one command. I searched the cp ...
1
vote
1answer
401 views

how to include wildcard characters in cp command

I want to use cp command in a script where the path structure has variable folder name. For example: folder structure: Workspace/unzipped_workspace/artifactory/my_folder123243/files Here ...
1
vote
1answer
43 views

Copying or rsyncing only files from subdirectories

I have a folder which is named Music. This folder contains the three subfolders Jazz, Rock and Folk. Now each of these three subfolders contains various .mp3 files. Now I want to copy the .mp3 files ...
0
votes
2answers
277 views

cp -r not copying all files from networked drive

I have an unusual problem, which is possibly down to me being a novice command line user, but also applies to using the GUI. The situation is that I have a networked drive mounted at /media/drive/dir ...
4
votes
2answers
158 views

Copying directories in linux only if it contains the specified file

I need to make a copy of all the folders under /parent (into a new location) but only if it has 123.dat - in which case I need to copy the folder too, but none of the other files it contains. So that ...
2
votes
0answers
234 views

cp -l instead of cp -s does not work?

I have a folder symlink to core files and a folder with my improvements like this: core/ -> /some/distant/root/directory/core/ script_a.py special/script_b.py special/script_c.py core-improvements/ ...
13
votes
8answers
3k views

Copy group of files (Filename*) to backup (Filename*.bak)

Background In Linux you can: List a group of files with ls Filename* Remove a group of files with rm Filename* Move a group of files with mv Filename* /New/Directory But you cannot copy a group of ...
0
votes
1answer
281 views

Insert value from JSON file into filename path

I need to copy a file and rename it based on a value from a json file: info.json { "folderName": "berlin" } to get the folderName from json I can use: jq '.folderName' info.json to copy the file ...
3
votes
1answer
276 views

Accidently removed very important file of my project by comman “cp”. Really need help [duplicate]

Very Long story short. In essence this is the problem. I had some of my project files (new.cc) which I was working on for quite sometime. I created one backup of these files two months ago(old.cc), ...
0
votes
0answers
45 views

Using my backup disk

I have made an Ubuntu backup using a 3.5' internal HDD hooked up to a SATA-USB adapter with power supply, and I formatted it to FAT. I can't seem to transfer normal files onto it, as when I try to ...
0
votes
2answers
398 views

cp: cannot create directory '/home/rexxi/usr/lib/firefox-addons/plugins': No such file or directory

I tried to move files from downloads dir cp -r ~/Downloads/flash_player_npapi_linux.x86_64 ~/usr/lib/firefox-addons/plugins And I got a error message cp: cannot create directory '/home/rexxi/usr/...
5
votes
1answer
763 views

Copy large number of files of specific date to another directory?

I've around 11K log files of specific date let say 26Feb inside one directory(there are other date data also). To copy only 26th Feb log files to destination from linux command line, I use below ...
0
votes
1answer
44 views

Can I use a list of file names that I saved to file to have each file on the list copied/moved/deleted?

How can I use cp rm or mv commands to manipulate files saved to a list, for example one made like so: ls Downloads/ | grep example > example.tmp The point is to be able to view/edit the file list ...
0
votes
0answers
116 views

Error while copying to flash derive

I tried to copy contents to usb(host system with ubuntu 16.04), this return is no error and but no "done" dialog box appears and havn't allocate any space in USB. it seems something like infinite ...
2
votes
1answer
601 views

Can't Copy from NTFS to EXT4

Running Kubuntu 18.04.01 bionic. I've tried Dolphin and the terminal but can't copy a .MOV file from 1TB usb drive NTFS to EXT4 on an Asus laptop. The permissions of the NTFS file show world rwx and ...
0
votes
0answers
49 views

60-latin.conf not a directory error in Ubuntu 16.04

I'm not able to login to system. When I tried to reinstall Ubuntu-desktop I'm getting error like Cp: cannot stat: /etc/fonts/conf.d/60-latin.conf not a directory and Plymouth failed with return 1 ...
0
votes
1answer
57 views

Linux: copy a list of file whose name suffix is listed in a txt file from one directory to another

I want to copy all the files that contain in their name the strings that are listed in a .txt file. How can I do it?
0
votes
1answer
76 views

Does storage affect file caching in cp?

I read somewhere that cp uses file caching, but why does coping something the size of ~100MB result in a file cache of more than 100MB in ram? Does this also change if copying from HDD -> HDD,SSD -> ...
0
votes
2answers
67 views

Copy only images in a specific directory ignoring the sub-directories in it

Excuse me for my Bad english.I want to copy only images(.png) present inside a specific directory(serenity) ignoring the sub-directories(datatables, images..etc,) in that, to another directory. ...
12
votes
1answer
2k views

Overwritten /usr/share/bin. Am I doomed?

I just managed to overwrite /usr/share/bin and it doesn't seem like it's possible to undo. I did this as a root user. Am I doomed?
0
votes
0answers
42 views

Does cp --update work with a samba share?

I have the impression that files I copy to a mounted samba share with cp -u are copied also when in fact the source file is older than the destition file. Or are there other timestamps then the one I ...
1
vote
1answer
81 views

Removed all files from Kindle device via cp command

I tried to copy a file to a Kindle device via command line in the following way: cp filename /dev/sdb5 where sdb5 is the name of that device. As result, all files from the Kindle device are removed. ...
1
vote
1answer
19k views

cp: cannot create regular file: Read-only file system

I have an bootable flash-card (with acronis (not my installation)), I may read but cannot copy file into it. When I uses windows, then I not have any problem, but I cannot use this card in ubuntu - ...
3
votes
1answer
44k views

cp: cannot stat: No such file or directory exists [duplicate]

Orienting myself with basic terminal commands (Ubuntu 16.04); I have a file listed in my Downloads folder; a Jupyter notebook file called, 'Indexing and Slicing.ipynb' and wish to copy the file to my ...
3
votes
0answers
133 views

How can I clone my installation to a btrfs partition and make it bootable?

I'm trying to copy all files, configuration, everything, to a new btrfs partition without reinstalling. So far, what I've tried is to go to a live cd session (which is actually booted from an iso ...
0
votes
0answers
38 views

Reliable safe way to copy multiple directories to backup folder? Linux Script [duplicate]

I have defined a list of folders I want my script to read from, for each folder in the list I want to copy all content to a backup folder I run cp -r /next_folder_inlist /to_backup , in a while loop ...
0
votes
1answer
165 views

Error while running Bash Script within landscape web UI

On landscape quickstart I running a simple script from the UI. My script look like that: #!/bin/bash cp $LANDSCAPE_ATTACHMENTS /home/afadmin/Downloads/ I got the following error: cp: omitting ...
1
vote
0answers
68 views

cp command removing files

I am attempting to copy a directory with many directories inside it. I am using cp -v -R source /mnt/dest. When I go back to the source all the files are missing, but the folder is there. I am ...
0
votes
1answer
90 views

Home folder synced to HD: results differ!

I'm new to Ubuntu. I would like to have an exact copy of my home folder on my Hard drive. I've tried the following (no programs running on Ubuntu): 1. Copy-paste ~/ to /dest1/ per drag and drop in ...
10
votes
2answers
1k views

Copy and paste a bunch of files with different name

I have a bunch of text files with the name foo_bar_abc_1_01_geh_original.in foo_bar_abc_1_02_geh_original.in foo_bar_abc_1_03_geh_original.in ... ... foo_bar_abc_1_1000_geh_original.in I would like ...
0
votes
0answers
47 views

Bash script : Navigate within directory and read the value from text file

I am trying to read a text file and then navigate inside the directory as per the first chars of the line i read from the file. please check the script below. #!/bin/bash filename="/...
34
votes
2answers
38k views

Copy file and keep same timestamp of original file

I need to copy file and after that I need to change timestamp attributes as original file. How to do it with terminal or any other way.
1
vote
1answer
55 views

Find, rename and copy files to a new directory

I have 3 files under a directory that represents the time which is under a directory that represents a date. Each time directory has similar files. I'm basically saving earth's magnetosphere ...