Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/bin/tcsh #1. Create a file of all disk images from the Netbackup catalog that N +etbackup thinks is on disk. echo "Creating list of all images that Netbackup thinks is on disk." cp /dev/null catall grep "F:\\backup" cat.txt | sed -e "s/F:\\backup\\/\*/g" | awk -F\* '{ +print "F:\\backup\\" $2}' >> catall grep "G:\\backup" cat.txt | sed -e "s/G:\\backup\\/\*/g" | awk -F\* '{ +print "G:\\backup\\" $2}' >> catall grep "H:\\backup" cat.txt | sed -e "s/H:\\backup\\/\*/g" | awk -F\* '{ +print "H:\\backup\\" $2}' >> catall #2. Create file of what's on disk echo "Create file listing of all images on disk." cp /dev/null dirall grep "_" Fdir.txt | awk '{print "F:\\backup\\" $5}' > dirall grep "_" Gdir.txt | awk '{print "G:\\backup\\" $5}' >> dirall grep "_" Hdir.txt | awk '{print "H:\\backup\\" $5}' >> dirall #3. sort the files echo "Sorting the two files" sort catall > catall.srt sort dirall > dirall.srt #4. check em echo "Checking the differences." diff -u dirall.srt catall.srt |grep "^-" |grep -v "\-\-\-" |sed -e s/\ +-//g > delfile.list #5. create batch file echo "Creating a batch file to delete the files that Netbackup doesn't + know about." awk '{print "del " $1}' delfile.list > delfile.bat
Retitled by g0n from 'tcsh'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Listing Files in a Directory (Translation From Shell Script)
by graff (Chancellor) on Sep 07, 2005 at 23:16 UTC | |
by ikegami (Patriarch) on Sep 07, 2005 at 23:33 UTC | |
|
Re: Listing Files in a Directory (Translation From Shell Script)
by Tanktalus (Canon) on Sep 07, 2005 at 22:59 UTC | |
|
Re: Listing Files in a Directory (Translation From Shell Script)
by Fletch (Bishop) on Sep 07, 2005 at 22:52 UTC | |
|
Re: Listing Files in a Directory (Translation From Shell Script)
by Anonymous Monk on Sep 07, 2005 at 22:45 UTC |