Using find on RedHat Linux

Discussion in 'Software' started by qqqmac, Nov 4, 2010.

  1. qqqmac

    qqqmac Private E-2

    Find problem - I am trying to port a HP-UX app to Linux

    Tried a find on Linux (which worked on HP-UX), but it returned failure status on Linux. Any way around this? Script follows:

    Script started on Thu 04 Nov 2010 04:03:46 PM EST
    [mym@clim-rh-trg test1]$ ls -laR
    .:
    total 16
    drwxrwxr-x 3 mym mym 4096 Nov 4 16:02 .
    drwx------ 21 mym mym 4096 Nov 4 15:43 ..
    -rw-rw-r-- 1 mym mym 0 Nov 4 15:43 morecrap
    -rw-rw-r-- 1 mym mym 0 Nov 4 16:03 typescript
    drwxrwxr-x 2 mym mym 4096 Nov 4 16:03 XXX111

    ./XXX111:
    total 8
    drwxrwxr-x 2 mym mym 4096 Nov 4 16:03 .
    drwxrwxr-x 3 mym mym 4096 Nov 4 16:02 ..
    -rw-rw-r-- 1 mym mym 0 Nov 4 16:02 crap
    [mym@clim-rh-trg test1]$ find . -type d -name 'XXX*' -exec rm -rf {} \;
    find: ./XXX111: No such file or directory
    [mym@clim-rh-trg test1]$ ls -laR
    .:
    total 12
    drwxrwxr-x 2 mym mym 4096 Nov 4 16:04 .
    drwx------ 21 mym mym 4096 Nov 4 15:43 ..
    -rw-rw-r-- 1 mym mym 0 Nov 4 15:43 morecrap
    -rw-rw-r-- 1 mym mym 0 Nov 4 16:03 typescript
    [mym@clim-rh-trg test1]$ exit
    exit

    Script done on Thu 04 Nov 2010 04:04:59 PM EST
     
  2. qqqmac

    qqqmac Private E-2

    Found out how to fix it - use the following:
    find . -type d -name 'XXX*' -print | xargs rm -fr
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds