recursive rename of folders
After using shred on a directory tree I am left with a structure of empty folders and subfolders. I'd like to rename the directories to something meaningless before deleting them, by replacing every character of the original name with a string (for instance 'app'). I've tried a few scripts found online but did not succeed in achieving the hoped-for result. I want to know what command or bash script to use in order to do that. Thanks.
|
You could do a find with an xargs but if you give some more detailed info with examples of what you are trying to do we can give you more specific examples of the code to write.
|
Quote:
I have tried some commands like: Code:
find . -depth -name "*[a-zA-Z0-9]*" -exec bash -c 'dir=${1%/*} base=${1##*/}; mv "$1" "$dir/${base//app/ }"' _ {} \; Code:
find /path/to/folder -print0 | xargs -0 mv [a-zA-Z0-9] app |
It looks like you are trying to do the equivalent of shredding the dirs themselves....
Given that dir entries in *nix ARE files, why not just use shred; much simpler? |
All times are GMT -5. The time now is 04:07 AM. |