2019-04-21 15:39:37

What I mean by this is, for example, I have the Adobe Sound Effects Library’s, and many of them have the same file names at the beginning, for example the category before the sound effect. It’s kind of annoying, and I want to be able to sort the better. Are there any applications for windows that can do this, remove the beginning file name, in this case the category name?

I would rather listen to someone who can actually play the harmonica than someone who somehow managed to lose seven of them. Me, 2019.

2019-04-21 19:43:44

advanced file renamer will help you out

There's a place for me in this universe.

2019-04-22 01:24:05 (edited by Josh 2019-04-22 01:39:12)

PowerShell can also do what you want with a single command. If I knew exactly what the file names looked like, I could give you specific instructions. Also, I'm assuming the files you want to change aren't just in one folder?

2019-04-22 01:53:46

There are several folders, each having a different set of file names.

I would rather listen to someone who can actually play the harmonica than someone who somehow managed to lose seven of them. Me, 2019.

2019-04-22 02:32:02

Can you be more specific about what the file names look like? Are the category names separated from the rest of the file names with spaces? With dashes? An example would be helpful.

You should be able to use a regular expression to replace the category portion of each file name with an empty string, giving you the files without the category names at the beginning. I can tell you exactly how to write it if I have an idea of what the file names look like.

2019-04-22 13:52:30

I'll have to wait till I get home to take a look.

I would rather listen to someone who can actually play the harmonica than someone who somehow managed to lose seven of them. Me, 2019.

2019-05-02 18:21:00

is there a program or command that will make a folder with the name of the category and place those files in the folder? In my case all files are in the same location

2019-05-02 19:20:03

Bulk rename utility ( https://www.bulkrenameutility.co.uk/Download.php )  is by far the best file renamer I've found. It has loads and loads of different options, but for you, the desired option would be the regular expression group of options. There are a ton of different regular expression guides online, and you can experiment by watching how the names look in the second column of the list view with the folder's files in it. You can use \1, \2, \3 etc for captureed matches as well.

I like to sleep, Sleep is good,
This is how I do it: Lie on a nice warm cozy bed, and dream dreams about how to rule the world!
Follow @TheGreatAthlon5 on twitter for humorous facts and game updates!
If you like my posts, thumb me up!

2019-05-02 19:33:04

Thanks. Do you also know a good one for mac?

2019-05-02 22:07:13 (edited by Zarvox 2019-05-02 22:08:13)

How do you use this? I see some unlabeled buttons. I found the button to select the path for the renamed files, and I also see the tree view to select the folder you want for renaming. But I clicked all the buttons near that area and nothing happened.

2019-05-05 10:38:44

I would be interested in the power shell commands. Just to clarify, this only works in Power Shell, which is a little more complex than command prompt?

Ulysses, KJ7ERC
She/they
Reedsy

2019-05-05 22:26:09

Command prompt would work in some instances, but from the research I've done, I don't think it's as powerful or flexible as PowerShell. Someone feel free to correct me if I'm wrong. I do know that regular expressions don't work in command prompt when renaming files.

The basic gist of the PowerShell command is this:
get-ChildItem | rename-item -newname {$_.name -replace 'insert regular expression here','string to replace any matches with'}

Now I'll break it down piece by piece:
get-ChildItem: lists all the files in a directory, just like cd in command prompt. If you want the command to list and/or operate on the current folder and all subfolders, add the -recurse switch. You can also do something like get-ChildItem *.mp3 if you only want to list files with the .mp3 extension.

| (vertical bar): feeds the output of get-ChildItem to the next command.

rename-item -newname: Takes all the files fed into it from get-ChildItem and changes them depending on the expression that is given to the -newname switch.
{$_.name: The left brace opens up a script block. The $_.name just says "do something to the name of each file that you receive."
-replace: This is a PowerShell operator that allows you to replace part of a file name or list of file names with something else or nothing at all if you so choose.
'insert regular expression here': Regular expressions would take far too long to explain adequately, but there are lots of tutorials that are only a Google search away. I'll give a few examples of what you could do at the end.
'string to replace any matches with': You can put some text here or an empty string, and the part of the file name(s) that match the regular expression will be replaced with whatever you want.
}: closes the script block

Clarifying examples:
get-ChildItem | rename-item -newname {$_.name -replace 'cat','dog'}: replaces all instances of cat with the string 'dog'
get-ChildItem | rename-item -newname {$_.name -replace 'cat',''}: replaces all instances of cat with an empty string, which removes it from each file name

Here's where the power of regular expressions starts to come into play. For these examples, let's say you have an SFX library like an idiot and you want to remove the first part of each file name. You could do something like this:
get-ChildItem | rename-item -newname {$_.name -replace '^.+? - ',''}: Says "only match at the beginning of each file name (^) and match one or more of any character (.+), followed by a space, a dash and another space. Replace any matches you find with an empty string." As for the question mark after the +, that just tells the regex engine to stop as soon as the pattern is matched rather than match as much as it can. This is called greedy vs lazy matching if you  want to find out more.
For example, if we have a bunch of sound effects that are explosions, and they have the string "Explosions - " at the beginning of each file name, the regex engine will match on it and replace it with an empty string. We tell the engine to lazy match because if we didn't, the engine would keep going after the string " - ". If we had a file name like "Explosions - Vol. 1 - bomb.wav", the lazy match would stop after "Explosions - ", leaving us with "Vol. 1 - bomb.wav". If we left off the question mark, however, it would match on "Explosions - Vol. 1 - ", just leaving us with bomb.wav. Both types of matching have their uses and it's up to you whether to use one or the other.

I hope this has been helpful. If you have any questions, let me know and I'll try to help you out. There is a lot to learn about regular expressions, and I barely scratched the surface here. I found that the tutorials at https://www.regular-expressions.info/tutorialcnt.html helped me increase my understanding of regular expressions.