people are all over find lately but I find piping ls through grep easier to remember – you can replace the whole find bit with ls | grep -e wav$ if all the files are in the directory you’re working in (ie not a subdirectory). ls lists all the files in the working directory, grep -e filters the input by a regular expression (you might also have egrep available which does the same), wav$ is a regular expression which matches any file or folder ending in wav

I was just trying to match the @john-smith example as close as possible.

As you mention ls is local, find is recursive…

oh yeah, didn’t mean that as a criticism, just another way of doing things

[edit: that said, I should really just get around to internalizing the find flags…]

Check this out:

find | grep wav$

versus

ls | grep wav$

No need for -e! find and ls to me are equally easy to remember (in basic forms), but are both useful in different situations…

1 Like

semi related to find but not much else— i recently discovered fzf, super helpful

Thanks for putting that together — it was largely the fact that I needed to create temporary files that was throwing me off :slight_smile:

The reason for find is its ability to make complex decisions as it traverses a file system tree; Find is not just a “set of flags” but an ordered set of instructions on how to search that tree, including which nodes to enumerate and which branches to cull (this is why the man/info pages are so extensive). Ls only has as much power to traverse as shell globbing affords, and no ability to arrest traversal. Using find where a shell glob would work is unnecessary, but shell globs and ls are in no sense a replacement for find.

1 Like

Actually I’m finding this isn’t working. :confused: First of all it didn’t seem to be able to handle spaces in folder names, then when I removed spaces it just did… nothing. I can’t see anything I’m doing wrong on my end, very confusing

Shell scripts have a tough time with filenames that have spaces, though usually that goes away if you put variables inside of quotes “$like_this”.

For spaces and other special characters, you’ll need to escape them with a \
Such as:

$ find . -name Unreal\ Projects
./Unreal Projects
./Documents/Unreal Projects
1 Like

Again: I was deliberately trying to work with your original one-liner. Yeah spaces in are not so fun.

On topic: I don’t have any spaces in file names, which to me seems like the simplest solution

Off topic: when doing more involved tasks, I quickly switch to python (from bash), I find it much more robust and elegant. For a purpose similar to yours I wrote a python script “a2wav”, which is an elaborate wrapper around sox.

1 Like

Has anyone been playing with Ish? It’s an Alpine emulator for ipadOS/iOS. I almost entirely set up a Pi Hole with it :grinning:

1 Like
for file in *.wav; do ffmpeg -i $file -ar 44100 -b:a 320k ${file%.*}.mp3; done

save yourself (from all that clicking seriously)

edit: bonus: id3mtag

6 Likes

Ish looks nifty! Too bad it needs TestFlight

yum - this looks better than sox

I recently (over the last 2 years) became more aquatinted with the cli. And after compiling a number of open source sample packs (CardOne, SuperDirt, etc…) I was left with lots of non .wav files in several sample directories.

find . -type f ! -iname '*.wav' -delete

^^^was my friend. Pretty basic stuff, but I wish I would have been more willing to learn this a while back.

p.s. -iname because for whatever reason half the wav files were all caps.

p.p.s. Can’t wait to make use of id3mtag. Last month I discovered my old college external hard drive which barely works but I was able to scrape old data from. All my mp3s no longer have any metadata other than decent folder organization and file names.

1 Like

youtube-dl "<URL HERE>" -o - | ffmpeg -i pipe: sample.wav

When you hear a sound in a YouTube video that you want to sample

10 Likes

If you have to tag a lot of music try beets as well http://beets.io it’s been working great for me.

Gonna mention easytag here just so it’s out there. If you don’t mind occasionally using a GUI, it’s really powerful, can scan tags from directory structure or file names, reorganize by tags, do batch operations, etc.

If you’re having trouble with spaces in paths when doing things like iterating over the output of ls, you can use

IFS="\t\n"

before your command. The IFS shell variable (“internal field separator”) governs how the shell splits strings, and here we set it to split on tabs and newlines only - the default value includes spaces.

4 Likes