Dont know if this are the right place but i try.
Im looking for a script that removes part of foldername. I have alot of folders that looks like:
- My images <-- Main folder
- Sync Mobile SD 2018-12-18 (2018) - rkgavgtr
- Sync Mobile Internal 2018-12-18 (2018) - rabavgtr
Etc. (There's a couple years sync)
The thing is that the string before and after the year sometimes are at diffrent length.
Im looking for a script that I can run that removes everything after the ")" on every folder in folder "My images".
Best Regards
Patrick.
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Remove part of foldername
Re: Remove part of foldername
Did you try any of these?
https://duckduckgo.com/html/?q=linux+re ... +last+part
https://duckduckgo.com/html/?q=linux+re ... +last+part
resigned by AI ChatGPT
Re: Remove part of foldername
I've been going to google for a couple of weeks but have not found what I'm looking for. I'm not so familiar with this with bash or script generally in debian.
Best Regards
Patrick
Best Regards
Patrick
Best Regards
Patrick
Patrick
Re: Remove part of foldername
Something like this should work (make sure you have "apt install rename").Putte_h wrote:Dont know if this are the right place but i try.
Im looking for a script that removes part of foldername. I have alot of folders that looks like:
- My images <-- Main folder
- Sync Mobile SD 2018-12-18 (2018) - rkgavgtr
- Sync Mobile Internal 2018-12-18 (2018) - rabavgtr
Etc. (There's a couple years sync)
The thing is that the string before and after the year sometimes are at diffrent length.
Im looking for a script that I can run that removes everything after the ")" on every folder in folder "My images".
Best Regards
Patrick.
$ find -type f -name \*\(\*\)\* -exec rename -v 's/\)(.+)$/\)/' {} \;
this will look for files (-type f) matching "*(*)*" (i.e. having something in brackets), and rename it replacing from the right bracket until the end, with a right bracket.
You can remove the "-v" to have it run silently. You can also add "-n" (i.e. .. rename -n -v ..) to only show what rename would do, without actually doing it.
I take no responsibility if you wipe your p0rn!