0

HI all,

am working on an opensource project(in Linux)..
I need to modify the string ,which is a part of the Folder,File,and others as such..

I have code to replace the string which is in content of the file....but i want the replacement to be done on the folder names and sub folders too....(and the main thing is some folders have extensions too)

Thank you

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by chinnaedu
0

HI all,

am working on an opensource project(in Linux)..
I need to modify the string ,which is a part of the Folder,File,and others as such..

I have code to replace the string which is in content of the file....but i want the replacement to be done on the folder names and sub folders too....(and the main thing is some folders have extensions too)


For file contents, use sed:

sed -i.bak 's/original/replacement/' "$file"

For filenames, use the shell's parameter expansion:

filename=${filename/original/replacement}
0

hey i could replace the file content...but i want to chanege the folder names,subfolder names,file names......

There are lot many subfolders, and files too, so if my input is "root directory name" and "old string" and "relpace with" then replacements should take place at all places in one go...

Thank you

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.