I basically want to add a string to all the files in a directory that are locked. I'm having trouble passing the filenames to a mv
command:
find . -flags uchg -exec chflags nouchg "{}" | mv "{}" "{}"_LOCK \;
The above code obviously doesnt work but I think it explains what I'm trying to do.
I'm facing two problems:
- Adding a string to the end of a filename but before the extension (
001_LOCK.jpg
). - Passing the output of the
find
command twice. I need to do this because it won't let me change the names of the files while they are locked. So I need to unlock the file and then rename it.
Does anyone have any ideas?