Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally removing words from file names #10

Open
novoid opened this issue Sep 13, 2020 · 3 comments
Open

Optionally removing words from file names #10

novoid opened this issue Sep 13, 2020 · 3 comments

Comments

@novoid
Copy link
Owner

novoid commented Sep 13, 2020

There are certain situations where I need to remove one or more words from selected file names.

One example is after added a set of words that contain a typo.

An implementation of this would also addresses #8

Constraints

This issue is a central spot to collect ideas on how to come up with a consistent concept to remove words. This has to work on one file as well as on a group of selected files. It has to work on file names that end with the same set of words as well as with sets of files that do have completely different file names.

Furthermore, there should be ways to deal with edge cases. A few examples:

  • Removing word(s) would produce file name conflicts (two ore more files with same file name in same directory)
  • User requested to remove words that are not available in file names
  • Resulting file name would be empty

Brainstorming

  • The user might be able to interactively enter -2 which results in removing the last two words (separated by spaces or underscores) from the file name.
  • Similar to removing tags with filetags, the user might be able to interactively enter -"foo bar" or -foo to remove the words "foo bar" or "foo" from the end of the existing file names of selected files. If not found, nothing gets removed. Filetags are ignored and are not considered being part of the file name here.
  • ...

Contribute!

Please add your ideas here as well!

@ghost
Copy link

ghost commented May 1, 2023

In my case I would like to have this feature. Sometimes I do not want to append text, I only want to replace the entire filename (maintaining the date or date-time). Is this possible right now, or is there any other way? I have found this tool https://github.com/ayoisaiah/f2 but right now I do not have much time to read the documentation. If you know about something to replace multiple files' filenames while maintaining date-times let me know.

@novoid
Copy link
Owner Author

novoid commented May 1, 2023

I only want to replace the entire filename (maintaining the date or date-time). Is this possible right now, or is there any other way? I have found this tool https://github.com/ayoisaiah/f2 but right now I do not have much time to read the documentation. If you know about something to replace multiple files' filenames while maintaining date-times let me know.

For use-cases like that, I'm using vidir or the according dired version within Emacs. However, when you don't use vim nor Emacs, there are multiple ways of modifying multiple file names in one go. There's mmv as a CLI tool and UI file browsers like FreeCommander/TotalCommander do offer features in that direction as well.

@ghost
Copy link

ghost commented May 4, 2023

Hi, thanks for the response. Finally I found a fast way of doing it. My filenames after taking photos with the camera are something like: ASC0001, ASC0010 ... The solution to renaming all of them with the same name is:

  • Use date2name -w ASC* to insert date and time to all those files.
  • Use f2: f2 -f 'ASC0*(?:[1-9][0-9][0-9]?|[1-9]|1000)*' -r 'replacetext' -x to replace the text ASC00...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant