![]() ![]() depending on your system you might need to change \d and \w to character classes like ] or ]. Please note: i only copy-pasted your regex please test it first with example files. type f -name "Friends*" -execdir bash -c 'mv "$1" "$ passes it on to the content of -execdirīetter explanations would be appreciated a lot :) If your linux does not offer rename, you could also use the following: find. In perl: -l0 stdout delimiter is the null byte (in octal 000).In perl and xargs: -0 stdin delimiter is the null byte (rather than space).Adjust to your use case-whether matching filenames or entire paths. In find: -printf '%P\0' print only name of files without path followed by null byte. ![]() How it works (abridged to include only changes from above) Be careful here (you might want to check your output of find before you run in through a regular expression match, or worse, a destructive command like mv). Note that I tried to easily support find. The first aforementioned method uses newlines as separators. The magic here is that each process in the pipeline supports the null byte (0x00) that is used as a delimiter as opposed to spaces or newlines. Let's say I want to rename all ".txt" files to be ".md" files: find. My preferred approach, albeit more advanced. -d "\n" cuts the input by newline, instead of default space character. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |