I have a list of folders from which I have to delete .dec files. How to delete from them at one time. Any for loop or something has to be used? Solutions: for loop or while loop: cat filename | while read line
Let says, you have folder: /tmp and subfolders /tmp/test1 and /tmp/test1 content in your filename looks like this: /tmp/test1
while loop will read line, and cd $line which means cd /tmp/test1 and rm -f *.dec in /tmp/test1, next, read next line Do it on test env first, or best advise, cp -rp /tmp/test1
/tmp/test1.bkup, just in case you screw up.
I need a script which basically deltes all files in folder a which are alreasy present in folder b Say folder a has files Code:
Code:
then file abc.txt and pqr.txt from a should be deleted Solutions: Check if this heps you get started: Code:
or Code: for file in `ls folderb`
or You can also try diff command to get listing. Code:
or Code:
or Code:
(c) www.gotothings.com All material on this site is Copyright.
|