this post was submitted on 21 Jul 2026
13 points (93.3% liked)

Linux

66599 readers
311 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS
 

Ik I can use grep to find filenames with specific characters and then print that to a list but idk how to utilize said list to rename. I found another solution which's using mv but couldn't figure out how to make it work w subdirectories. I think using both grep and mv in unison's the answer just idk how to do it. plz halp

you are viewing a single comment's thread
view the rest of the comments
[–] bjoern_tantau@swg-empire.de 1 points 4 days ago (1 children)

Are you maybe looking for mmv (multimove)?

It's hard to tell what you actually want to do.

But you should not need to use grep to finde specific files. Just bash's own abilities should be enough.

For example */*a* would go into every directory and look for files with "a" in them.

For more complex operations find can also be used.

[–] sinextitan@lemmy.world 1 points 4 days ago (4 children)

basically I'm mirroring my music library to my new phn and Android shits itself when it encounters ?,*," in filenames. I used to manually remove them but today I decided to actually learn how to automate.

[–] ranzispa@mander.xyz 1 points 3 days ago

If you want to manage a music library, you may be interested in Beets

[–] MonkderVierte@lemmy.zip 1 points 4 days ago (1 children)

Btw, yt-dlp has a --restrict-filenames option.

[–] sinextitan@lemmy.world 1 points 4 days ago* (last edited 3 days ago) (1 children)

I didn't get my music from yt-dlp. and even if the source title contains special chars, yt-dlp uses chars that look the same but aren't.

edit: am aware of the feature but the one I mentioned does the job for me

[–] thingsiplay@lemmy.ml 1 points 4 days ago (1 children)

yt-dlp has an option to rename downloaded files to restrict to ASCII characters (and another option to restrict filename length). I usually use my own wrapper script around yt-dlp, but I guess you already have your own. So for that, you can use the option --restrict-filenames to "Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames". See all options with man yt-dlp. Try it out.

[–] sinextitan@lemmy.world 1 points 3 days ago

Ik of yt-dlp being able to rename the media that I download using it. but I didn't use it to get my music. plus it's not a prob that I have w yt-dlp. even w/o yt-dlp using their same same but not same chars, Linux doesn't mind ?,* and " in filenames. but I do like the feature as / does present probs.

[–] eleijeep@piefed.social 1 points 4 days ago (1 children)

Are you just trying to remove special characters from the filename, or are you also trying to move them to new directories?

[–] sinextitan@lemmy.world 1 points 4 days ago

trying to remove them so that I can transfer to Android. I can use grep to improve my manual process but I'd love for it to be automatic.

[–] bjoern_tantau@swg-empire.de 1 points 4 days ago

Nice, extra hard because those symbols all have special meanings when searching something. Nice puzzle, I wish I had the energy to solve it right now.