Comments on: 16 Useful ‘cp’ Command Examples for Linux Beginners https://www.linuxtechi.com/cp-command-examples-linux-beginners/ Mon, 03 May 2021 00:22:54 +0000 hourly 1 By: Jeff https://www.linuxtechi.com/cp-command-examples-linux-beginners/#comment-23022 Mon, 03 May 2021 00:22:54 +0000 https://www.linuxtechi.com/?p=8217#comment-23022 I’m looking for a way to take a directory listing and > to a cp or rsync maybe using awk and & so that if I have 100 files in a directory it will spawn 100 threads. I’ve done this with a bash script before… ls > quickcopy then vi and add cp or rsync commands and an & to background, chmod +x and let it fly but it would seem that there would be a way to just do this from command line. It would also be nice to wrap it in a nice -5 and a time command. I mean it seems like there would be a command like this already built for times when you are trying to make 20 copies of flash drives for your whole extended family of 500 old pictures. Or a server. Yeah. Or for files on a server. I did it when I was working in seismic… Same thing.

]]>
By: Pradeep Kumar https://www.linuxtechi.com/cp-command-examples-linux-beginners/#comment-22968 Thu, 15 Apr 2021 02:10:40 +0000 https://www.linuxtechi.com/?p=8217#comment-22968 In reply to MANBAHADUR.

Hi Manbahadur,

If I understand your query correctly, You want to create same directory structure skipping the files. You can achieve this by running below rsync command

$ rsync -av -f”+ */” -f”- *” /home/linuxtechi/Documents /home/pkumar/Documents

In the above command, first one is the source path of directory and second one is the target path where we want to sync directory structure.

]]>
By: MANBAHADUR https://www.linuxtechi.com/cp-command-examples-linux-beginners/#comment-22960 Wed, 14 Apr 2021 07:30:14 +0000 https://www.linuxtechi.com/?p=8217#comment-22960 how to copy only directory data not files. what should I follow

]]>
By: RSYDW https://www.linuxtechi.com/cp-command-examples-linux-beginners/#comment-8324 Fri, 22 Mar 2019 03:08:19 +0000 https://www.linuxtechi.com/?p=8217#comment-8324 Good article,helpful.

]]>
By: Bob Crochelt https://www.linuxtechi.com/cp-command-examples-linux-beginners/#comment-7442 Tue, 12 Feb 2019 16:20:40 +0000 https://www.linuxtechi.com/?p=8217#comment-7442 Thanks. This is very helpful

]]>