Composers Desktop Project Forum
News:
Release 8 is now available:
https://unstablesound.net/cdpforum/index.php?board=4.0
Home
Help
Search
Login
Register
Composers Desktop Project Forum
»
General Category
»
General Board
»
Newbie question: Process entire folder in Terminal
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Newbie question: Process entire folder in Terminal (Read 4818 times)
uge
Jr. Member
Posts: 6
Newbie question: Process entire folder in Terminal
«
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
Logged
rwdobson
Sr. Member
Posts: 74
Re: Newbie question: Process entire folder in Terminal
«
Reply #1 on:
June 03, 2021, 02:34:00 PM »
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
Logged
uge
Jr. Member
Posts: 6
Re: Newbie question: Process entire folder in Terminal
«
Reply #2 on:
June 04, 2021, 06:02:18 AM »
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
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Composers Desktop Project Forum
»
General Category
»
General Board
»
Newbie question: Process entire folder in Terminal