Composers Desktop Project Forum
General Category => General Board => Topic started by: uge on June 02, 2021, 08:02:02 AM
-
Hello there,
I'm enjoying using the CDP in Terminal. I would like to know if is possible to use CDP commands with wildcards (*) in order to process entire folders.
Any help with this would be appreciated.
Thanks in advance,
Cheers,
Uge
-
The idiomatic way to do this is to use the shell scripting facilities. It is a good idea to read up on shell commands (and practice a little before committing to anything serious). Simple commands can be done directly at the prompt, but most of the time you will want to create a text file for your script. Here is an example to copy files to a named subdirectory:
#!/bin/bash
# usage copyfiles.sh outdir
# copies wave files in current directory to same names in directory outdir
# outdir will be created if not present
# copysfx must be in system PATH
if [ -z $1 ]; then
echo "usage: ./copyfiles.sh outdir"
echo "outdir will be created if it does not exist."
echo
exit
fi
if [ $1 == "." ]; then
echo "can't copy files into same directory!"
echo
exit
fi
if [ ! -d $1 ]; then
mkdir $1
fi
for filename in *.wav
do
copysfx $filename $1/$filename
done
-
Thanks a lot,
I'll start experimenting with this. Yesterday I was reading a book about UNIX and I was trying some FOR loops with no luck. But this is the key of everything. I'll try this and practice with it.
Thanks again,
Uge