0

Someone gave me this to recursively expand folder placeholders:

exec 7>&1
output="go"
while [ "$output" ]; do
    output=$(find . -name "*.cloudf" -print0 | xargs -0 -n 1 python odrive.py sync | tee /dev/fd/7)
done

(.cloudf are odrive placeholder files; the sync command expands them into folders, and these new folders will then contain more .cloudf placeholders which need to expanded.)

It works. The problem is that after running it a few times, it stops showing its progress.

The exec 6>&1 and tee /dev/fd/6 are supposed to be some kind of trick for showing progress ... but they only work once or twice, then they stop working.

I tried changing the 6 to 7 and other numbers, but that didn't help.

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Dan
  • 1,257
  • 2
  • 15
  • 31
  • I don't know about the rest of your command line or what "odrive" or `.cloudf` files might be for, but if you open a redirection with `exec 7>&1`, you may rant to close it when you're done with `exec 7>&-`. – ghoti Sep 03 '17 at 13:37
  • Thanks, I tried that; still not printing progress... – Dan Sep 03 '17 at 13:44

1 Answers1

0

This works (albeit with some extra blank lines):

while [[ -n $(find . -name '*.cloudf') ]]; do 
   find . -name "*.cloudf" -print0 | xargs -0 -n 1 -P $p python odrive.py sync; 
done

(With the help of this and this)

Dan
  • 1,257
  • 2
  • 15
  • 31
  • I don't see how this addresses the issue of your missing output through `tee`. It doesn't even use fancy redirection. But anyway .. if you've solved your problem with this, please mark the answer as correct to "close" the question. – ghoti Sep 04 '17 at 03:07