I need to write a script to naviagate into the list of specified folder and delete the files in it.
I have mentioned the list of folders in a external file so it can be reusable.
The issue is am facing now is that, i am not understating on how to navigate into the folder locations specified inside the external file.
For now i am using this mechanisum...
cat /filelist.txt | while read INTLIST
do
rm -rf *
done
but this is throwing error as
INTLIST: not found
here filelist.txt has the list of paths to which i have to navigate....
$ awk '{print "rm "$0"/*"}' /path/of/filelist.txt | sh
You can execute this line alone to remove the files inside the specified directories mentioned in filelist.txt .
This awk command will append the "rm" command syntax to your existing filelist.txt file and it passes the content to "sh" to remove it .. For testing purpose, neglect the "sh" and run the code.. If satisfies with the result then add "sh" at the end .. Hope it clears ..