6

loop through a DIR to delete files by inode

view full story
linux-howto

http://www.linuxquestions.org – I have a directory that contains some files (over a 1,000) that have a '\' in the filename. There are also some good files that I need to keep. therefore I need a script to delete based on inode. What I have thus far: list="$(ls -il /opt/PC/log/*RPOUT*.xml)" #this gives me the list # I need to get the inode of. for i in $list do find . -inum $i -exec rm -i {} \; echo "delete file" $i >> /home/me/tmp/del_inode.txt done echo 'completed' I know this is not right ... what I know is is the 'find' is. I need to loop through the $list gleaning inodes to get all the files with '\' delete. I'm not sure how. The $i gives me the whole line. I just want the first position. set $() does not seem to work ... any ideas? (HowTos)