[plug] Recursive Copying of Folder Contents
Adrian Chadd
adrian at creative.net.au
Wed Jun 3 18:37:45 WST 2009
Split the task up and write some simple shell scripts.
Part 1 - find /path/to/directory -type f > files.txt
Part 2 - write a shell script to read in a list of files on stdin and
run "cp" on it, eg
#!/bin/sh
DESTDIR=$1
while read R; do
cp -v ${R} ${DESTDIR}/
end
Adrian
In-Reply-To: <4A264D1F.6050608 at iinet.net.au>
On Wed, Jun 03, 2009, Jason Posavec wrote:
> The Subject header pretty much sums it up. I want to recursively copy
> the contents only of nest folders to a specified destination.
>
> Basically, I have all my music managed by Rhythmbox in folders nested as
> Music/Artist/Album/Tracks. I want to copy all the music files to a
> common folder. SoundConverter allows me to load my Music folder
> recursively, and convert all the files to a common folder, but will only
> do this via a conversion, not a straight copy.
>
> I tried the copy command:
>
> cp -r --copy-contents ~/Music/* destination_folder
>
> but that insisted on copying folders as well. Obviously --copy-contents
> doesn't do what I think it does.
>
> Thanks in advance.
>
> Jason Posavec
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://www.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au
--
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $25/pm entry-level VPSes w/ capped bandwidth charges available in WA -
More information about the plug
mailing list